Script not working for the edit variables in RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 06:02 AM - edited 02-27-2024 06:03 AM
Hi,
I wrote a small script to see that a logged in user should be able to edit the fields in the RITM provided the logged in user is from SHAREPOINT SUPPORT group but, it's not working. I impersonated as one of the users of that group, but the fields remain not editable. Kindly help.
onLoad Client Script
function onLoad() {
if (g_scratchpad.isMember != 'true') {
g_form.setReadOnly('team_name', true);
g_form.setReadOnly('business_group', true);
g_form.setReadOnly('content_owner', true);
g_form.setReadOnly('team_purpose', true);
}
}
Business Rule
(function executeRule(current, previous /*null when async*/ ) {
if (gs.getUser.isMember("SHAREPOINT SUPPORT"))
{
g_scratchpad.isMember = 'true';
}
})(current, previous);
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 06:04 AM
Hi,
Change the Display BR as below
(function executeRule(current, previous /*null when async*/ ) {
if (gs.getUser.isMemberOf("SHAREPOINT SUPPORT")) //function is isMemberOf , you had isMember
{
g_scratchpad.isMember = 'true';
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 06:18 AM
hi @Community Alums
change below:
(function executeRule(current, previous /*null when async*/ ) {
if (gs.getUser.isMemberOf("SHAREPOINT SUPPORT")) //use ismemberof
{
g_scratchpad.isMember = 'true';
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 06:19 AM
Hi @Community Alums, Can you try gs.getUser().isMemberOf as shown in the below script?
(function executeRule(current, previous /*null when async*/ ) {
if (gs.getUser().isMemberOf("SHAREPOINT SUPPORT"))
{
g_scratchpad.isMember = 'true';
}
})(current, previous);
Regards,
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 06:52 AM - edited 02-27-2024 06:53 AM
Hi @Anurag Tripathi @SunilKumar_P @Naga Ravindra R ,
Thank you so much, but it didn't work. So, I updated the business rule and removed onLoad Client Script completely. This is not working either. I am doubting if the Business Rule is running at all. I don't get any alert. Kindly help.
(function executeRule(current, previous /*null when async*/ ) {
if (gs.getUser.isMemberOf("SHAREPOINT SUPPORT"))
{
alert("i am in the sharepoint support group");
g_form.setReadOnly('team_name', false);
g_form.setReadOnly('business_group', false);
g_form.setReadOnly('content_owner', false);
g_form.setReadOnly('team_purpose', false);
}
else{
alert("i am not in the sharepoint support group");
g_form.setReadOnly('team_name', true);
g_form.setReadOnly('business_group', true);
g_form.setReadOnly('content_owner', true);
g_form.setReadOnly('team_purpose', true);
}
})(current, previous);
Regards
Suman P.