- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 10:44 AM
Hi All,
We have a custom field on the knowledge form called "Content Owner Group", If "Ownership Group" is from one of the specific groups( around 100 groups), I need to populate the Content Owner Group as "XYZ" group.
I cannot use UI policy, Got some idea from community Client Script + Display BR to achieve this.
I have created new system property and defined all the Ownership Group sys ids, But I am not sure how to fetch Sys property values in client script to achieve the requirement.
Can anyone help me on this or is there any other way to achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 11:12 AM - edited 11-02-2022 11:36 AM
Hello,
Please do the below:-
Write a display BR with below code:-
(function executeRule(current, previous /*null when async*/) {
g_scratchpad.my_property = gs.getProperty('propertyname');
})(current, previous);
The on the onchange client script of Ownership Group field call it using the below code:-
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var myProperty = g_scratchpad.my_property;
if(myProperty.indexof(newValue)>-1)
{
g_form.setValue('Content Owner Groupfieldname','sysidofxyzgroup');
}
}
Please mark my answer as correct based on Impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2022 05:33 AM
Hello,
Also create a onload client script with the below code:-
function onLoad() {
var myProperty = g_scratchpad.my_property;
var grpname=g_form.getValue('ownershipfieldgrpname');
if(grpname!='')
{
if(myProperty.indexOf(grpname)>-1)
{
g_form,setReadOnly('contentgrpfielname',true);
}
}
Please mark my answer as correct based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2022 06:20 AM
Hi @Saurav11,
It is working fine, I need this functionality for knowledge blocks as well, Can we modify this on load & on change script without creating new script for knowledge blocks?
I found the "Class" field on knowledge table, but we are not enabled that field on the form, Can we achieve this without creating new script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2022 06:40 AM
hello,
If any field is on the same table then yes you can use the same script.
Please mark my answer as correct based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 11:19 AM
Hi @Saranya2,
Take a look at my one of the article related to System properties and its usage. It will help you.
Thanks,
Sagar Pagar