Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi,
How to add UserSessionShapes in User Management Subsystem programmatically.
I'm using the below code to update it
// table: INFOTABLE dataShape: ""
let data = Subsystems["UserManagementSubsystem"].GetConfigurationTable({
tableName: "UserSessionShapes" /* STRING */
});
// Provide your filter using the format as described in the help topic "Query Parameter for Query Services"
let query = {
"filters": {
"type": "And",
"filters": [{
"fieldName": "name",
"type": "EQ",
"value": "MYSHAPE"
}]
}
};
let params = {
t: data /* INFOTABLE */ ,
query: query /* QUERY */
};
// result: INFOTABLE
let sessionData = Resources["InfoTableFunctions"].Query(params);
if (sessionData.length === 0) {
data.AddRow({
"name": "MYSHAPE"
});
Subsystems["UserManagementSubsystem"].SetConfigurationTableRows({
values: data /* INFOTABLE */,
persistent: true /* BOOLEAN {"defaultValue":true} */,
tableName: "UserSessionShapes" /* STRING */
});
}
var result = data;
When I execute the code I'm getting this error
UserSessionShapes does not have a primary key field assigned - See Script Error Log for more details.
The above script works with the normal thing configuration Table.
Please help me with this. Thanks in advance.
/VR
Solved! Go to Solution.
Hi @Velkumar ,
Im not sure about the SetConfigurationTableRows serivce in UserMananagemnetSubsytem why it's not as same with other.
If you want to add Session Shapes in UsermanagentSubsytem in programatically better to use the service - AddSessionShape. It may help you.
Subsystems["UserManagementSubsystem"].AddSessionShape({
name: 'MYSHAPENAME' /* THINGSHAPENAME */
});
Thanks & Regards,
Arun C
Hi @Velkumar ,
Im not sure about the SetConfigurationTableRows serivce in UserMananagemnetSubsytem why it's not as same with other.
If you want to add Session Shapes in UsermanagentSubsytem in programatically better to use the service - AddSessionShape. It may help you.
Subsystems["UserManagementSubsystem"].AddSessionShape({
name: 'MYSHAPENAME' /* THINGSHAPENAME */
});
Thanks & Regards,
Arun C