Hello,
Yes, I'm sure. I get it through a mod file, so the trigger is called in post validation of attachment.
Here's the .mod :
OBJECT attmnt {
TRIGGERS {
POST_VALIDATE zattmnt_send_maps(id,created_by) 666 FILTER( EVENT("INSERT") );
};
} ;
And the .spl :
attmnt::zattmnt_send_maps(...)
{
if(substr(created_by.userid,0,5)== "GIPSI")
return;
string method;
int _id;
method = "zattmnt_send_maps";
_id = (int)argv[3];
object zobj;
send_wait(0, top_object(), "call_attr", "lrel_attachments_requests", "sync_fetch", "STATIC", format("attmnt = %d", _id), -1, 0); // make sure that attachment id is INT
if (!msg_error()) {
send_wait(0, msg[0], "dob_by_index", "DEFAULT", 0, 0);
zobj = msg[0];
logf(SIGNIFICANT, "Attachment : %s, %s : %s", zobj.attmnt, zobj.cr.type.sym, zobj.cr.ref_num);
}
else {
logf(ERROR,"%s", msg[0]);
return;
}
string cmdlineprocess;
string parameters;
string serveur;
string proc_path;
serveur = getenv("NX_WS_SERVER");
proc_path = getenv("NX_PROC_PATH");
parameters = format("-serveur %s -port %s -action %s -attmnt_id %s", serveur, "8443", "ATTMNT", _id);
// Lancement du batch d'appel du Web Service
cmdlineprocess = proc_path +" "+parameters;
logf (SIGNIFICANT, "%s - Calling command... [%s]", method,cmdlineprocess);
send(bpnotify_object(), "create_process", cmdlineprocess);
logf (SIGNIFICANT, "%s - command executed...", method);
if (msg_error()) {
logf (ERROR, "%s - Error while calling cmd line object: %s", method, msg[0]);
return;
}
logf(SIGNIFICANT, "-- %s completed!", method);
}
Chris.