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

Get Impact and Urgency values from JSON

Wyatt Fudal1
Tera Guru

Hello,

 

I'm running into issue getting the Impact and Urgency field value. My code is not working. I think I did something wrong with my code. 

JSON Data

23T20:33:41Z","Subcategory":"Other","CustomerImpact":"No","Description":"TEST","BusinessImpact":"TEST","WatchList":[],"WatchList@odata.type":"#Collection(Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser)","WatchList#Claims":[],"WatchList#Claims@odata.type":"#Collection(String)","Impact":"Low","Urgency":"High","Queued":false,"Modified":"2024-04-

My code

function getImpactID(impactValue){
    var impactValue = new GlideRecord ('impact');
    impactValue.addQuery('value', impactValue);
    impactValue.query();
    if(impactValue.next()) {
        return impactValue.sys_id;
    }
}

function getUrgency(_urgencyValue){
    var urgencyValue= new GlideRecord ('urgency');
    urgencyValue.addQuery('value', urgencyValue);
    urgencyValue.query();
    if(urgencyValue.next()) {
        return urgencyValue.sys_id;
    }
   
   
}
1 ACCEPTED SOLUTION

Wyatt Fudal1
Tera Guru

I able to get it to by doing this, thank you all for the help!!

function levelStringToNumber(value) {
    switch (value) {
        case "High":
            return 1;
       
        default:
        case "Medium":
            return 2;

        case "Low":
            return 3;
    }
}

View solution in original post

7 REPLIES 7

Should I try getImpactChoice and GetUrgencyChoice? 

I dont see getImpactID & getUrgency functions getting called in the main script area similar to how you are calling getUserId function.

 

Regards,

Sharad

Wyatt Fudal1
Tera Guru

I able to get it to by doing this, thank you all for the help!!

function levelStringToNumber(value) {
    switch (value) {
        case "High":
            return 1;
       
        default:
        case "Medium":
            return 2;

        case "Low":
            return 3;
    }
}