You need to sign in to do that
Don't have an account?
Tejender Mohan 9
Not able to update Assignment Rule using Update Metadata API call.
I have been trying to update the Assignment Rule's Rule Entry assignTo field using UpdateMetadata Call. I have tried several ways but still not able to update it. Can someone please suggest any solution? Below is the code snippet :
MetadataService.IReadResult readResult = new MetadataService.ReadAssignmentRulesResult(); readResult = service.readMetadata('AssignmentRules', new String[]{'Lead'}); MetadataService.Metadata[] mdInfo = readResult.getRecords(); MetadataService.AssignmentRules TempAssignmentRules = (MetadataService.AssignmentRules) mdInfo[0]; System.debug('Assignment Rule Name :---> '+ TempAssignmentRules.AssignmentRule[0].fullname); System.debug('Assigneee Name :---> '+TempAssignmentRules.AssignmentRule[0].ruleEntry[0].assignedTo); //Updating Value Here TempAssignmentRules.AssignmentRule[0].ruleEntry[0].assignedTo='teXYZ.com'; //Update MetadataService.SaveResult[] results = service.updateMetadata(new MetadataService.Metadata[] { TempAssignmentRules}); System.debug('ERROR : '+ results[0].errors[0].message); //Error is "unexpected metadata".
Hello Deepak
The issue is still not solved.
I raised a case with Salesforce, they created a known issue and that is still not fixed.
https://trailblazer.salesforce.com/issues_view?id=a1p3A000001GebvQAC