How to add If/else statemet in reference qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 07:54 AM
Hi All,
We have a requirement where I need to add two functions of a script include with if else condition.
If variable is Add Members then it should be script include and the below function
ClientUtils().isManagerOfGroup(); and variable is Remove Member then it should be other function
ClientUtils().isOwnerOfGroup();
Thanks in Advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 08:14 AM
@Kaustubh k - Which variable are you referring to - catalog variable? Please describe your question in detail (preferable with screenshots)
I would call just one SI function with one parameter and let the parent function of SI decide which other SI function to call based on the value of the passing parameter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 12:26 AM
Hi Anubhav,
Yes I am referring to a variable of a catalog item 'Group Name'.
If they select Add Members or Remove Members ,then it should only populate the groups whom I am manager of in the Group Name,for which I have a script include and an function- ClientUtils().isManagerOfGroup(); and for rest I want to populate the groups for which I am owner -ClientUtils().isOwnerOfGroup();
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 11:01 PM - edited 10-29-2024 11:02 PM
Add this is is you refQual:- new javascript : if="current.variable=='Remove Managers'||current.variable=='add memeber'"?ClientUtils().isManagerOfGroup() : ClientUtils().isOwnerOfGroup()
if any query reach out to me...
if this resolve your query please Mark helpfull this answer..!!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 11:16 PM
Hi @Kaustubh k
Create a new function in the ClientUtils() script include and pass the action parameter to the manageGroup function.
Example script
manageGroup: function(action)
{
if (action === 'Add Members')
{
return this.addMembers();
} else if (action === 'Remove Members')
{
return this.removeMembers();
}
},
Please mark this response as Correct and Helpful if it helps you can mark more that one reply as accepted solution
Thanks
Eshwar