I've read as much as possible in the forum and find it strange that no one ever asked for that exactly...
During Case creation, which runs under an enabled new Case Workflow rule, I want that the Channel field is dynamically changed when the user changes the assigned user.
I supposed basically that I would solve this easily with :
1) a Create Script that sets the case_assigneduserid "Defaultvalue=CurrentUser.user_userid;"
2)an OnChange Script on the case_assigneduserid to change the case_channelid, but then I find it impossible to do that easily as I am here stuck at a client side level.
var AssignedUserID = crm.fields("case_assigneduserid").value(); //this is quite easy to retrieve the assigned user id.
But what about finding the Channel Id of this AssignedUserId ?
How can I do that within the scope of the new Case Workflow rule ?
Any help would be appreciated...
You need to do a client side sdata Ajax call passing the Id of the user found in the above query then read the field from the crmRecord object returned I.e crmRecord.user_primarychannelid. The client side api documentation has code detailing how to do it in principal.
Hmm I've never used Ajax with Sage CRM. I wonder what the authentication for the sdata call would look like. I imagine you wouldn't be storing the username & password in clear text.
You don’t need to authenticate as the sage crm client side api takes care of it by using the session id your logon generated as part of the call. 10 lines of code is all you need.
Wow this looks very elegant. It's a very clean way for OP to do this.