Skip to main content
19-Tanzanite
Aug 8, 2023 12:39 PM UTC
Solved

How to add/update UserSessionShapes in User Management Subsystem programmatically

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

 

Arun_CAnswer
16-Pearl
Aug 9, 2023 7:45 AM UTC

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

2 replies

Arun_C16-PearlAnswer
16-Pearl
Aug 9, 2023 7:45 AM UTC

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

Translate
Velkumar19-TanzaniteAuthor
19-Tanzanite
Aug 9, 2023 7:55 AM UTC

Thanks @Arun_C  this helps. 

Translate