ars_MergeEntry(ctrl, schema, mergeType, ...)
There are three conditions to detect after ars_MergeEntry(...).
foreach $RPTID (sort keys %RPTEntryList) { undef @Report; ( @Report = ars_GetEntry($ctrl1, $ISS_RPT_SCHEMA, $RPTID) ) || arsdie("GetEntry $RPTID"); if ( $ret = ars_MergeEntry($ctrl2, $ISS_RPT_SCHEMA, 3075, @Report) ) { print "$RPTID -> new $ret\n"; } else { arsdie("MergeEntry $RPTID $ret") if $ars_errstr; print "$RPTID replaced\n"; } }Note the value "3075" for mergeType. That translates to
2048: skip field pattern checking 1024: allow NULL in required fields + 3: delete existing entry and create new in its place ------- 3075
$ars_errstr
will be "" (or, more correctly, %ARS::ars_errhash
will not contain any FATAL or ERROR messages - but might contains WARNINGs or NOTICEs). $ars_errstr
# note that "4" means "overwrite existing" $a = ars_MergeEntry($ctrl, "HD:HelpDesk", 4, 1 , "00000000012345", 2 , "FOOBAR"); if(($a eq "") && ($ars_errstr eq "")) { print "entry successfully over-written\n"; } else { print "failed to merge - $ars_errstr\n"; }
# note that "2" means "create a new entry" $a = ars_MergeEntry($ctrl, "HD:HelpDesk", 2, 2 , "FOOBAR"); if(($a ne "") && ($ars_errstr eq "")) { print "entry successfully created - $a\n"; } else { print "failed to merge - $ars_errstr\n"; }
Notes
Note: If you try to merge a diary field (to alter existing diary entries) you need to pass the encoded diary to this routine. See ars_EncodeDiary.
mergeType
defines how the merge will happen if special
field (ie. Entry-Id) already exists:
Code | Meaning |
---|---|
1 | Generate an error |
2 | Create a new entry with the new entry id |
3 | Delete the existing entry and create a new on in its place |
4 | Update fields specified in the fieldlist in existing entry |
1024+num above | Allow NULL in required fields (not applicable for Submitter, Status or Short-Description) |
2048+num above | Skip field pattern checking |
Refer to the Remedy Programmers Manual for further details.
The Object Oriented ARSperl layer tries to be a little easier to use.
ars_MergeEntry was introduced in version 1.46 of ARSperl
Last changes to this page 29-Mar-2003 by jcmurphy