Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2021-04-21 08:39 AM
Hello group. We have a working custom object that updates a values list field based on the user group. It was fairly easy to maintain with a limited number of groups. But that is now changing and I need a better solution that allows for flexibility.
Existing solution -
if(v.RequestedObject.Name == "Group 1 Test Owner" || v.RequestedObject.Name == "Group 2 Test Owner" || v.RequestedObject.Name == "Group 3 Test Owner" || v.RequestedObject.Name == "Group 4 Test Owner" || v.RequestedObject.Name == "Group 5 Test Owner" || v.RequestedObject.Name == "Group 6 Test Owner") {
UpdateValueList(fldId, fluId)
What I'm looking for is the ability to replace the number values with a wildcard. All the group names will start with 'Group' and end with 'Test Owner'.
TIA
2021-04-22 09:51 AM - edited 2021-04-22 12:58 PM
It seems to work, JSFiddle - Code Playground Click Run at the top right and you should get a pop-up of true. Line 28 of the JavaScript panel is the text I tested against.
You'd call the function like so:
matchRuleShort(v.RequestedObject.Name, "Group*Test Owner");
Advisory Consultant
2021-04-21 09:20 AM
Scott, this post might help, Wildcard string comparison in Javascript - Stack Overflow
Advisory Consultant
2021-04-21 10:57 AM
Thanks, that link did come up in my searching, but have not yet been able to make it work. Just have to keep trying..
2021-04-22 09:51 AM - edited 2021-04-22 12:58 PM
It seems to work, JSFiddle - Code Playground Click Run at the top right and you should get a pop-up of true. Line 28 of the JavaScript panel is the text I tested against.
You'd call the function like so:
matchRuleShort(v.RequestedObject.Name, "Group*Test Owner");
Advisory Consultant
2021-04-22 10:00 AM
Thank you for that reference, will give it a try.