I used the add attachment feature on self service. The files are stored in the record. When the file is added , the workflow should be triggered and send the attachment to some role users.
But i found that after the file is uploaded , MY_DOC data is populated by the delivery code. But the data in MY_ATT would be populated after the user click the save button. Even after i added the DoSaveNow peoplecode. Cionfused why the savenow code did not take affect.
Anyone has the same expeience or any suggestion ?
Let me make it detail.
I created two records
XX_DOC and XX_ATT
XX_DOC includes the subrecord FILE_ATTDET_SBR
XX_ATT includes the EMPLID,ATTACHSYSFILENAME,ATTACHUSERFILE fields.
I created one cust page.
The page includes the all the fileds and the fields ATTACHADD/ATTACHVIEW/ATTACHDELETE from record FILE_ATTACH_WRK.
Create the URL XX_URL
Add the below peoplecode to the componenet.field.fieldchange.
Declare Function add_attachment PeopleCode FILE_ATTACH_WRK.ATTACHADD FieldChange;
Declare Function display_attachment_buttons PeopleCode FILE_ATTACH_WRK.ATTACHADD RowInit;
Local number &CurRow, &RETCODE;
Local string &Guid, &URL_ID;
&URL_ID = "URL.XX_URL";
&Guid = UuidGenBase64();
add_attachment(@&URL_ID, "", &Guid, 0, True, "Record.XX_ATT", XX_ATT.ATTACHSYSFILENAME, XX_ATT.ATTACHUSERFILE, 2, &RETCODE);
If &RETCODE = %Attachment_Success Then
My requirement : the user needs to add an attachmen/attachements and workflow should be triggered (the files would be sent out for approval) when clicking the save button.
My questions, when i add the attachment and the file should be saved in the XX_DOC record but the data of XX_ATT would be saved after the user click the save button. The save action of data does not sync although i added the DoSaveNow peoplecode.
That would cause that the workflow would not find the new added attachement when the email is sending out.
Any idea ?