- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 02:42 AM
Hi ,
I have a Script Include which sets the "group" field based on "type" field, however I am not supposed to use sys_id in script include and created system property for each sys_id which needs to be called in script include
Below is the code which is working fine when sys_id is directly added to the script , here my question is how to add system property in place of sys_id in the below code?
var a = gs.getProperty(populate.group.based.on.type.finance);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 02:48 AM
Hi @Nandini DM,
try this code
u_getGroupRefQual: function() {
var filter = '';
var financeSysId = gs.getProperty('populate.group.based.on.type.finance');
if (current.variables.do_you_need_access_to_finance_hr_or_it_applications.getDisplayValue() == 'Finance') {
filter = 'active=true^type=' + financeSysId;
}
return filter;
},
Please hit helpfult and accept this as a solution if it solved your problem.
Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 02:47 AM
Hi @Nandini DM in your system property the sys_id is referring to which record and does the system property have multiple sys id? I donot see your storing property value anywhere in script include.
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 02:48 AM
Hi @Nandini DM,
try this code
u_getGroupRefQual: function() {
var filter = '';
var financeSysId = gs.getProperty('populate.group.based.on.type.finance');
if (current.variables.do_you_need_access_to_finance_hr_or_it_applications.getDisplayValue() == 'Finance') {
filter = 'active=true^type=' + financeSysId;
}
return filter;
},
Please hit helpfult and accept this as a solution if it solved your problem.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 03:25 AM
Hi @M Ismail
This is working as expected,
One question ,what if system property is having multiple sys_id's?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 03:53 AM
Hi @Nandini DM
for multiple sys_ids we can handle by this
1. **Using a Delimiter**:
var financeSysIds = gs.getProperty('populate.group.based.on.type.finance').split(',');
for (var i = 0; i < financeSysIds.length; i++) {
var financeSysId = financeSysIds[i];
// Use financeSysId in your logic
}
```
2. **Adjusting Logic**:
var financeSysIds = gs.getProperty('populate.group.based.on.type.finance').split(',');
var currentType = current.variables.do_you_need_access_to_finance_hr_or_it_applications.getDisplayValue();
if (currentType == 'Finance' && financeSysIds.includes(current.type.toString())) {
// Perform action for matching type
}
```
These code snippets handle multiple sys_ids stored in the system property and provide a way to iterate over or check against each sys_id. Adjust them as needed based on your specific requirements and business logic.
Please hit helpful and accept this as a solution if it solved your problem.
Thank you!