You need to sign in to do that
Don't have an account?
Button to Assign case to a user
Hi all,
I'm trying to create a button which will assign a case to a UserID which matches a custom field on the case. For example, our stores have an Account name of 'STORE NAME - xxxx' where xxxx is a four digital store number. In the account is a custom field 'Store Number'. In the case, we can the account of the store, but the User Name attached to the store is 'Store Manager xxxx' which matches the store number. Once all this is done, the page will refresh and show the Store Manager as the new case owner.
Is there any way in the Javascript below I can search for the relevant Store Manager user ID from the Store Number? My JS isn't that great.
Store ID is {!Case.StoreId__c}
-------------------------------------------------------------------------------
{!REQUIRESCRIPT("/support/console/41.0/integration.js")}
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
{!REQUIRESCRIPT("/xdomain/xdomain.js")}
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.OwnerId = '{!$User.Id}';
var result = sforce.connection.update([caseObj]);
if (result[0].success=='false') {
alert(result[0].errors.message);
} else {
var refreshPrimaryTab = function showTabId(result) {
var tabId = result.id;
sforce.console.refreshPrimaryTabById(tabId, true);
};
function doPrimaryTabRefresh() {
sforce.console.getEnclosingPrimaryTabId(refreshPrimaryTab);
}
doPrimaryTabRefresh();
}
----------------------------------------------------------------------
1. Create new custom checkbox field
2. Update Button to check this checkbox field on your case record
3. When checkbox is checked, the process you create in process builder will fire to call a visual flow
4. Create visual flow to use your Case ID and Account ID as parameters , and allow the flow to use that information to lookup the store manager and update the case owner field with the stor emanager ID.
Hope this helps,
Shawn