Hello Community!
Any have a example to send a notification menssage from script task c#?
The idea is make a foreach and for each value send a notification to the user.
Regrads,
Like
2 comments
17:36 Nov 29, 2017
Dear Federico,
Here's the example for you:
//create reminding
/**
* @param addresserContactId // select Id from Contact
* @param addresseeContactId //select Id from Contact
* @ RemindTime {DateTime}
* @param description {String}
* @param subjectRecordId //select Id from [your schema]
* @param sourceId // select Id from RemindingSource --where Name = 'Owner' or Name = 'Author'
* @param sysSchemaUid //select Uid from SysSchema where Name = [your schema]
* @param subjectCaption {String}
* @param typeCaption {String}
*
* return {Terrasoft.Collection of InsertQuery}
*/
createRemindingInsert: function (addresserContactId, addresseeContactId, remindTime, description,
subjectRecordId, sourceId, sysSchemaUid, subjectCaption, typeCaption) {
var insert = Ext.create('Terrasoft.InsertQuery', {
rootSchemaName: "Reminding"
});
insert.setParameterValue('Id', Terrasoft.generateGUID(), Terrasoft.DataValueType.GUID);
insert.setParameterValue('CreatedOn', new Date(), Terrasoft.DataValueType.DATE_TIME);
insert.setParameterValue('CreatedBy', Terrasoft.SysValue.CURRENT_USER_CONTACT.value, Terrasoft.DataValueType.GUID);
insert.setParameterValue('ModifiedOn', new Date(), Terrasoft.DataValueType.DATE_TIME);
insert.setParameterValue('ModifiedBy', Terrasoft.SysValue.CURRENT_USER_CONTACT.value, Terrasoft.DataValueType.GUID);
insert.setParameterValue('Author', addresserContactId, Terrasoft.DataValueType.GUID);
insert.setParameterValue('Contact', addresseeContactId, Terrasoft.DataValueType.GUID);
insert.setParameterValue('RemindTime', remindTime, Terrasoft.DataValueType.DATE_TIME);
insert.setParameterValue('Description', description, Terrasoft.DataValueType.TEXT);
insert.setParameterValue('SubjectId', subjectRecordId, Terrasoft.DataValueType.GUID);
insert.setParameterValue('Source', sourceId, Terrasoft.DataValueType.GUID);
insert.setParameterValue('SysEntitySchema', sysSchemaUid, Terrasoft.DataValueType.GUID);
insert.setParameterValue('SubjectCaption', subjectCaption, Terrasoft.DataValueType.TEXT);
insert.setParameterValue('TypeCaption', typeCaption, Terrasoft.DataValueType.TEXT);
return insert;
},
/**
*
* @param remindingInsertCollection {Terrasoft.Collection of InsertQuery}
* @param callback
*/
executeReminding: function (remindingInsertCollection, callback, scope) {
var batchQuery = Ext.create("Terrasoft.BatchQuery");
Terrasoft.each(remindingInsertCollection.getItems(), function (insertQuery) {
batchQuery.add(insertQuery);
});
batchQuery.execute(callback, scope);
}
Lisa
16:28 Sep 14, 2020
Lisa Brown,
Hi Lisa. Its been a few yrs since your reply. Is there a better way to do this in the product now? The code you have mentioned writes to the DB and triggers an execute.
Show all comments