Convert the Nintex forms office 365 JS to Cross Domain call


Badge +4

Nintex forms had a JS in on-premise which has been migrated to office 365 Nintex. The JS is not working. how to make this to work.

 

 
function CheckClipAmount()
{
    // Get the Plant
    var sPlant = NWF$('#' + varddlPlant + ' option:selected').text();
    if (sPlant == 'Please select a value...')
    {
        alert ('Please select a Plant.');
        return;
    }
    
    // Get the Amount
    var sAmount = NWF$("#" + varlaTotalValue).val();
 
    // Get the GOA Message
    var sGOAMessage = 'GOA not required';
    var url;
    url = _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/GetByTitle('ClipLevels')/items?$select=Message&$filter=(Title eq '" + sPlant + "' and MinAmount le " + sAmount + " and MaxAmount gt " + sAmount + ")";
    var call = NWF$.ajax(
    {
        url: url,
        type: "GET",
        async: false,
        dataType: "json",
        headers: { Accept: "application/json;odata=verbose" }
    });
    
    call.done(function (data, textStatus, jqXHR)
    {
        if (data.d.results[0])
        {
            var rtDATA = data.d.results[0].Message;
            sGOAMessage = rtDATA;
        }
    });
    
    call.fail(function (jqXHR, textStatus, errorThrown)
    {
        alert("Error Getting Active Data: " + jqXHR.responseText);
        return;
    });
    
    // Display the GOA Message
    alert('For Plant '' + sPlant + '' and Amount '' + sAmount + '' the GOA Message is: ' + sGOAMessage);
}

0 replies

Be the first to reply!

Reply