Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
I have created a project(Project A) , Template and a thing. Now i need to create 10 things dynamically using a service and then each service has to be configure a project (Project A). I am able to create a thing using a service CreateThings but while using this service it doesn''t provide the param named as project so that i can provide the name of the project that i want it to be binded.
Solved! Go to Solution.
Hi Slangley,
Adding the answer for the above ques:
Step1: Need to create a thing and enable it. use the below service for the same:
var params = {
name: 'Thingabc'/* STRING */,
description: undefined /* STRING */,
thingTemplateName: 'ProjectTemplate' /* THINGTEMPLATENAME */,
tags: undefined /* TAGS */
};
// no return
Resources["EntityServices"].CreateThing(params);
Things["vc"].EnableThing();
Things["vc"].RestartThing();
Step2: Then use a service to bind this thing to a project as shown below:
var params = {
searchExpression: 'Thingabc' /* STRING */,
types: 'Thing' /* JSON */,
tags: undefined /* TAGS */
};
// no return
Projects["ProjectName"].AddEntities(params);
Regards,
Saddam
got the answer.
Hi @shussain1.
Glad you found the solution you needed. Would you mind sharing the details of that solution and then marking your response as the Accepted Solution? That will help others who may have similar questions.
Regards.
--Sharon
Hi Slangley,
Adding the answer for the above ques:
Step1: Need to create a thing and enable it. use the below service for the same:
var params = {
name: 'Thingabc'/* STRING */,
description: undefined /* STRING */,
thingTemplateName: 'ProjectTemplate' /* THINGTEMPLATENAME */,
tags: undefined /* TAGS */
};
// no return
Resources["EntityServices"].CreateThing(params);
Things["vc"].EnableThing();
Things["vc"].RestartThing();
Step2: Then use a service to bind this thing to a project as shown below:
var params = {
searchExpression: 'Thingabc' /* STRING */,
types: 'Thing' /* JSON */,
tags: undefined /* TAGS */
};
// no return
Projects["ProjectName"].AddEntities(params);
Regards,
Saddam
Hi @shussain1.
Thank you so much for sharing your solution and marking it as the Accepted Solution! You involvement in the community is greatly appreciated.
Regards.
--Sharon