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

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

How to add/update UserSessionShapes in User Management Subsystem programmatically

Velkumar
19-Tanzanite

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

 

ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

2 REPLIES 2

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

Velkumar
19-Tanzanite
(To:Arun_C)

Thanks @Arun_C  this helps. 

Announcements


Top Tags