Important Update: Some Community URL Redirects are Under Maintenance. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom object for user group

ScottNess1
Contributor III

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

4 REPLIES 4

DavidPetty
Archer Employee
Archer Employee

Scott, this post might help, Wildcard string comparison in Javascript - Stack Overflow

 Advisory Consultant

Thanks, that link did come up in my searching, but have not yet been able to make it work.  Just have to keep trying..  

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

Thank you for that reference, will give it a try.