How to setup a limit on approval when reached max purchased right count on software entitlement.

spandana kalla
Tera Contributor

Hi Community,

 

Firstly, we should write a script to limit approval once reached purchased right in one entitlements. Firstly we should query the current members of the AD group and then count the number of purchased rights in one entitlements. Compare it against the purchased right limit. I had already written a script in run script workflow. But it's not working. @Dr Atul G- LNG  @Ankur Bawiskar @Mark Roethof 

Script : 

 
var answer;
var item = current.cat_item.getDisplayValue();
var gr = new GlideRecord('alm_license');
gr.addQuery('display_name=DocuSign DocuSign CLM+ Standard User for SFDC', item);
gs.log('Suja' + item);
gr.query();
while (gr.next()) {
    var lic = gr.purchased_rights;
    gs.log('Suja' + lic);
    if (purchased_rights < 170) {

        answer = 'yes';
        gs.log('Suja' + answer);
    } else if (purchased_rights > 170) {

        answer = 'no';
        gs.log('Suja' + answer);
    }
}
 
Thanks,
Spandana.
5 REPLIES 5

@Ankur Bawiskar @Mark Roethof @sandeep dutta

can you please help ?

 

Thanks,

Spandana.