Getting the following error when writing the data using write to data store entity smart service
There is a problem with task “Write RTRR roles AMU” in the process “RTRR Roles By AMU”. An error occurred while trying to write to the entity “RTRR_USER_ROLES” [id=6d16b390-92dc-4240-b4a0-b6f27e3156b3@9823, type=RTRR_USER_ROLES (id=2818)] (data store: RTRR Datastore). Details: java.lang.IllegalArgumentException: The list of records to be saved must not be null or empty: TypedValue[it=2819,v={}] Data: TypedValue[it=2819,v={}]
Followed the below steps
1)Created table with PK
2)created sequence for the PK value generation
CREATE TABLE "BPMSDATA"."RTRR_USER_ROLES"
( "ROLEID" NUMBER(18,0),
"OPERATINGDISTRICTDESC" VARCHAR2(40),
"AMUDESC" VARCHAR2(40),
"ROLE" VARCHAR2(40) ,
"USERNAME" VARCHAR2(40),
CONSTRAINT "RTRR_USER_ROLES_PK" PRIMARY KEY ("ROLEID"));
commit;
CREATE SEQUENCE "BPMSDATA"."RTRR_ROLES_AMU_SEQ " MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 660 CACHE 20 NOORDER NOCYCLE ;
3)created CDT in Appian via XSD
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:com:husky:types:appian:ewr" targetNamespace="urn:com:husky:types:appian:ewr"> <xsd:complexType name="RTRR_USER_ROLES"> <xsd:annotation> <xsd:appinfo source="appian.jpa"> @Table(name="RTRR_USER_ROLES", schema="BPMSDATA") </xsd:appinfo> <xsd:documentation><![CDATA[BPMSDATA.EPM_PARF]]></xsd:documentation> </xsd:annotation> <xsd:sequence> <xsd:element name="ROLEID" type="xsd:int"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Id @SequenceGenerator(name="RTRR_ROLES_AMU_SEQ", sequenceName="RTRR_ROLES_AMU_SEQ") @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="RTRR_ROLES_AMU_SEQ") @Column(name="ROLEID")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="OPERATINGDISTRICTDESC" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="OPERATINGDISTRICTDESC", nullable=false)</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="AMUDESC" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="AMUDESC")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="ROLE" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="ROLE")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="USERNAME" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="USERNAME")</xsd:appinfo> </xsd:annotation> </xsd:element> </xsd:sequence> </xsd:complexType></xsd:schema>
4)Published the cdt to datastore
5)Populating the values to CDT in process model. logic to populate CDT
RTRREngineerAllUsers
load( local!rtrrAMUListOfUsers:ri!rtrrAMUListOfUsers , append(ri!rtrrAMUListOfUsers,rule!EWR_PARF_USERS_FOR_AMUGROUPS(ri!selectedAMUCode_txt,local!rtrrAMUListOfUsers)))
EWR_PARF_USERS_FOR_AMUGROUPS
with(local!engingeerGroup: a!forEach( items: rule!RTRR_createGroupName( ri!selectedAMUCode_txt, cons!RTRR_SUFFIX_GROUP_NAME_ENGINEER ), expression: getgroupbyname( fv!item ) ), local!RTRREngineerUsers: a!forEach( items: local!engingeerGroup, expression: { if( rule!isObjectNull( fv!item ), {}, { {"amuname":group(fv!item, "groupName"),"username":tostring(getdistinctusers(fv!item))} } ) } ), a!forEach(items:local!RTRREngineerUsers, expression:{ rule!RTRRMAPCDTValues(userlist:fv!item.username,amuname:fv!item.amuname,rtrrAMUListOfUsers:ri!rtrrAMUListOfUsers) } ) )
RTRRMAPCDTValues
append(ri!rtrrAMUListOfUsers,a!forEach(items:ri!userList,expression:{cast('type!{urn:com:husky:types:appian:ewr}RTRR_USER_ROLES' , {"OPERATINGDISTRICTDESC":"","AMUDESC":ri!amuname, "ROLE":cons!RTRR_SUFFIX_GROUP_NAME_ENGINEER, "USERNAME":fv!item /*concat(user(fv!Item,"firstName")," ",user(fv!Item,"lastName"))*/})} ) ) CDT data from PV
[ROLEID=, OPERATINGDISTRICTDESC=, AMUDESC=RTRR Abbey Engineer, ROLE=Engineer, USERNAME= ], [ROLEID=, OPERATINGDISTRICTDESC=, AMUDESC=RTRR Aberfeldy Engineer, ROLE=Engineer, USERNAME=]
Discussion posts and replies are publicly visible