The CreatorCon Call for Content is officially open! Get started here.

Call a property in script include which is called in Reference Qualifier

Nandini DM
Tera Contributor

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);

 u_getGroupRefQual: function() {
        var filter = '';
        if (current.variables.do_you_need_access_to_finance_hr_or_it_applications.getDisplayValue() == 'Finance') {
            filter = 'active=true^type=747c67191b59ac500b457662164bcba4';
        }
        return filter;
    },
 
Please help me!
Thank you in advance!
1 ACCEPTED SOLUTION

M Ismail
Tera Guru

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!

View solution in original post

13 REPLIES 13

Harish KM
Kilo Patron
Kilo Patron

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.

Regards
Harish

M Ismail
Tera Guru

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!

Hi @M Ismail 
This is working as expected,
One question ,what if system property is having multiple sys_id's?

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!