Individual Task ITK
Individual Task ITK
`
Start
Fetching item revision tag and API check function for error
declaration of variables. check
!=NULLTAG
Using the relation tag, create the
relation between the IR and form
using GRM_create_relation() and
save relation using
GRM_save_relation() api
!=NULLTAG
=NULLTAG
Check for
null tag
END
Algorithm
(Every api is sent to the ITKCALL macro function to check for the error )
4. Retrieve the value of the "current_id" property (`cpItemid`) from `tRev` using
AOM_ask_value_string.
5. Retrieve the value of the "current_revision_id" property (`cpcRevid`) from `tRev` using
AOM_ask_value_string.
6. Calculate the size (`iSize`) required to store the name for the dataset based on `cpItemid` and
`cpcRevid`.
7. Allocate memory for the `newFormName` character array with a size of `iSize`.
9. Create a new form object (`tNewForm`) using FORM_create2 with the constructed
`newFormName`, "FormDesc," and "A7Cus_FORM."
12. Find the relation type "IMAN_specification" and store it in `tSpecification` using
GRM_find_relation_type.
14. Create a relation (`tRelation`) between `tRev` and `tNewForm` using GRM_create_relation.
17. Find the process template (`tProcTemp`) with the name `cpProcessTempName` using
EPM_find_process_template.
21. Set the `attachments` array to contain `tNewForm` and `attachment_types` array to contain
`EPM_target_attachment`.
22. Create a new process (`tNewProTemp`) with the name `cpProcessName`, "FormDesc,"
`tProcTemp`, and the attachment information using EPM_create_process.
27.End
CODE
#undef ITKCALL // The macro function to check for the api errors
#define ITKCALL(argument) \
do { \
int retcode = argument; \
if (retcode != ITK_ok) { \
char* s; \
TC_write_syslog("Function call: %s\n", #argument); \
TC_write_syslog("Returns [%d]\n", retcode); \
EMH_store_error(EMH_severity_error, retcode);\
EMH_ask_error_text(retcode, &s); \
TC_write_syslog("Teamcenter ERROR--------------------: [%s]\n", s); \
TC_write_syslog("File: %s, Line-----------------------: %d\n\n", __FILE__, __LINE__); \
if (s != NULL) MEM_free(s); \
}\
} while (0)
attachments[0] = (tag_t)tNewForm;
int attachment_types[1];
attachment_types[0] = EPM_target_attachment;
ITKCALL(EPM_create_process(cpProcessName, "FormDesc", tProcTemp, 1, attachments,
attachment_types, &tNewProTemp)); //creating the new process ufing workflow template
AOM_save_without_extensions(tNewForm);
AOM_refresh(tNewForm, false);
SAFE_SM_FREE(newFormName);
TC_write_syslog("-------------End-------------\n");
return 0;
}