Skip to main content
16-Pearl
May 23, 2024 5:52 AM UTC
Question

"Unable To Parse JSON Request" in Application logs while executing the below code from mashup

Iam continously getting error: "Unable To Parse JSON Request" in Application logs while executing the below code from mashup but the code providing results successfully while executing directly from Service. Kindly tell me what is the problem in below code.

 

The code is:

try{
var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
    infoTableName: "InfoTable",
    dataShapeName: "FabShopIntake.ScheduleTasks-DS"
});
if(editedTable===true){ Users[CurrentUser].SheetMetal_ScheduleTasks = editedTable;}
else if(AssignedToGroup === true) 
            result = griddata;
else{
    result.AddRow({
        Select : true,
        GroupName : "LASER CUTTER Group",
        Order : 1
    });
    result.AddRow({
        Select : true,
        GroupName : "BEND-WELD-SEC OP Group",
        Order : 2
    });
    result.AddRow({
        Select : true,
        GroupName : "PAINT Group",
        Order : 3
    });
    result.AddRow({
        Select : true,
        GroupName : "SHIPPING Group",
        Order : 4
    });
}
}catch(err){
logger.warn("SheetMetalScheduleGroups: error is "+err);
}
 
 
 
 
 
 

9 replies

24-Ruby IV
May 23, 2024 8:17 AM UTC

More about this error:

Translate
16-Pearl
May 23, 2024 8:44 AM UTC

I tried all of the above. Still it is not working.

Translate
15-Moonstone
May 23, 2024 10:36 AM UTC

I copied the code and added the input params "editedTable" (BOOLEAN) and "AssignedToGroup" (BOOLEAN). I also created a datashape with the same columns as you (but different entity name).

 

The service is running just fine.

 

I can only suspect that the "griddata" variable (which seems to be also an input parameter) is invalid somehow. Comment out the "if" cases one by one and see were it throws the error.

Translate
16-Pearl
May 23, 2024 11:16 AM UTC

Yes when iam including griddata infotable, then iam getting this error.

griddata is a infotable datatype created as one of the field definitions in datatable. 
Iam passing this field value from grid to service in mashup.

Translate
15-Moonstone
May 23, 2024 1:08 PM UTC

Then I think that the "gridData" does not have the correct format or is not a valid infotable in some sense. Can you log the "gridData" variable in the ScriptLog and post it here?

 

logger.warn(JSON.stringify(gridData));
Translate
Rocko
19-Tanzanite
May 27, 2024 6:36 AM UTC

"result" variable type is Infotable, but griddata type is JSON.

I don't see a conversion in the code?

Translate
Community Moderator
May 30, 2024 8:04 AM UTC

Hello @AP_10343008, 

 

It looks like you have some responses from some community members. If any of these replies helped you solve your question please mark the appropriate reply as the Accepted Solution. 

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Community Moderation Team.

Translate
16-Pearl
May 30, 2024 2:39 PM UTC

I added default empty row in the datashape of infotable type column present in datatable. It made the service execute when there is no value present in the particular column.

 

Thanks

Translate