cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

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

AP_10343008
15-Moonstone

"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 9

More about this error:

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

DanZ
15-Moonstone
(To:AP_10343008)

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.

AP_10343008
15-Moonstone
(To:DanZ)

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.

DanZ
15-Moonstone
(To:AP_10343008)

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));
AP_10343008
15-Moonstone
(To:DanZ)

The output is below for the code logger.warn(griddata.ToJSON());

 

JSON:

{"rows":[{"GroupName":"uu"}],"dataShape":{"fieldDefinitions":{"GroupName":{"name":"GroupName","aspects":{"isPrimaryKey":false},"description":"","baseType":"STRING","ordinal":2},"Order":{"name":"Order","aspects":{"isPrimaryKey":false},"description":"","baseType":"NUMBER","ordinal":3},"ClosingTime":{"name":"ClosingTime","aspects":{"isPrimaryKey":false},"description":"","baseType":"DATETIME","ordinal":5},"Select":{"name":"Select","aspects":{"isPrimaryKey":false},"description":"","baseType":"BOOLEAN","ordinal":1},"ClosedBy":{"name":"ClosedBy","aspects":{"isPrimaryKey":false},"description":"","baseType":"STRING","ordinal":4},"LastScheduledGroup":{"name":"LastScheduledGroup","aspects":{"isPrimaryKey":false},"description":"","baseType":"BOOLEAN","ordinal":6},"Location":{"name":"Location","aspects":{"isPrimaryKey":false},"description":"","baseType":"STRING","ordinal":7}}}}

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

I don't see a conversion in the code?

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.

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

Announcements


Top Tags