I am trying to create entity group record via script. I am using record.create api to create entity group record. But in record.type enum, I don't see 'entitygroup' parameter value. How it can be done? Please advice.
This is function to create entity group record,
function entityGroupCreation(name, subAbbrev, searchId){
var entityGroupRec = record.create({ type: 'entitygroup' });
log.debug("entityGroupRec",entityGroupRec);
entityGroupRec.setValue('grouptype', 'Employee');
entityGroupRec.setValue('dynamic', true);
entityGroupRec.setValue('groupname', `${subAbbrev} Folder Grp - ${name}`);
entityGroupRec.setValue('savedsearch', searchId);
return entityGroupRec.save({ enableSourcing: true, ignoreMandatoryFields: true });
}
I am trying to create entity group record via script. I am using record.create api to create entity group record. But in record.type enum, I don't see 'entitygroup' parameter value. How it can be done? Please advice.
This is function to create entity group record,
function entityGroupCreation(name, subAbbrev, searchId){
var entityGroupRec = record.create({ type: 'entitygroup' });
log.debug("entityGroupRec",entityGroupRec);
entityGroupRec.setValue('grouptype', 'Employee');
entityGroupRec.setValue('dynamic', true);
entityGroupRec.setValue('groupname', `${subAbbrev} Folder Grp - ${name}`);
entityGroupRec.setValue('savedsearch', searchId);
return entityGroupRec.save({ enableSourcing: true, ignoreMandatoryFields: true });
}
Share
Improve this question
asked Jan 29 at 17:03
Maira SMaira S
716 bronze badges
2
|
1 Answer
Reset to default 0Script worked when I used record.create api as below:
record.create({ type: 'entitygroup', defaultValues: { grouptype: 'Employee', Dynamic: true } });
Need to add mandatory fields in the default values.
entitygroup
is the correct ID according to the Record Browser. I don't seegrouptype
ordynamic
as valid field IDs, so those might cause problems, but the record type you have is correct. You aren't forced to use the enumeration. – erictgrubaugh Commented Jan 29 at 17:06