Skip to main content
16-Pearl
May 23, 2024
Question

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

  • May 23, 2024
  • 4 replies
  • 2318 views

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

4 replies

24-Ruby III
May 23, 2024

More about this error:

16-Pearl
May 23, 2024

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

15-Moonstone
May 23, 2024

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.

16-Pearl
May 23, 2024

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.

15-Moonstone
May 23, 2024

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));
Rocko
19-Tanzanite
May 27, 2024

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

I don't see a conversion in the code?

Community Moderator
May 30, 2024

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.

16-Pearl
May 30, 2024

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