function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Hi,
I need to run all territory assignment rules from an scontrol.
My code is as follows:
var accountResult = sforce.connection.query("SELECT Id, Name FROM Account LIMIT 1"); var accountRecords = accountResult.getArray("records"); var accountIs = accountRecords[0]; output = "<br>" + output + accountIs.Id + " " + accountIs.Name + "<br>"; var account = new sforce.SObject("Account"); account.id = accountIs.Id; sforce.connection.assignmentRuleHeader = {} sforce.connection.assignmentRuleHeader.useDefaultRule = "true"; updateResult = sforce.connection.update([account]); if (updateResult[0].getBoolean("success")){ output = output + "Account with Id " + account.id + " updated<br>"; } else{ output = output + "Failed to update account " + updateResult[0]; } state.output.innerHTML = output;
According to the AJAX toolkit developers guide the SOAP header option is used as follows:
sforce.connection.assignmentRuleHeader = {} sforce.connection.assignmentRuleHeader.useDefaultRule = "true";
This does not work, the rules do not run when the account is updated.
Can anyone please help.
Hi,
I need to run all territory assignment rules from an scontrol.
My code is as follows:
According to the AJAX toolkit developers guide the SOAP header option is used as follows:
sforce.connection.assignmentRuleHeader = {}
sforce.connection.assignmentRuleHeader.useDefaultRule = "true";
This does not work, the rules do not run when the account is updated.
Can anyone please help.
Code:
sforce.connection.sessionId="{!$Api.Session_ID}";
function refreshTerritoryRule(id) {
if ( id.substring(0,3)=='001' ) {
var acc=new sforce.SObject("Account");
acc.id=id;
sforce.connection.assignmentRuleHeader = {};
sforce.connection.assignmentRuleHeader.useDefaultRule = "true";
result=sforce.connection.update([acc]);
if (! result[0].getBoolean("success"))
alert('Unable to refresh Territory Rule...'+result[0]);
}
closeForm();
}