Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
FormAPI Question
GodBlessMe
Hi I am able to save a DCR with a predefined name. I want to call a Perl Script as soon as the DCR is saved and pass the DCR name as parameter to this perl script.
How do I do that?
Thanks.
Find more posts tagged with
Comments
Migrateduser
This will pass the workarea as iw_workarea and file as iw_file (the same way workflow passes them, I think).
function getCategoryAndType()
{
return( top.gTDT );
}
function getWorkarea()
{
return( top._dcWin.gWorkarea );
}
function generate()
{
var parameters = new Object();
parameters.iw_workarea = getWorkarea();
parameters.iw_file = "templatedata/" + getCategoryAndType() + "/data/" + IWDCRInfo.getDCRName();
IWDatacapture.callServer( "/iw-bin/your-script.ipl", parameters, true );
return( true );
}
function generateTimeout()
{
setTimeout( "generate()", 300 );
return( true );
}
IWEventRegistry.addFormHandler( "onSaveDone", generateTimeout );
GodBlessMe
what does the callServer() method do? Does it return any values ?
Thanks
GodBlessMe
How do I access the parameters in the Perl Script?
Thanks
Migrateduser
I really don't use Perl anymore (JSP is much better) but it might look something like this.
use CGI;
my ${cgi} = new CGI();
my ${iw_workarea} = ${cgi}->param( 'iw_workarea' );
my ${iw_file} = ${cgi}->param( 'iw_file' );
print $cgi->header(), ${cgi}->start_html();
print << END_SCRIPT;
<SCRIPT>
{ your javascript here }
</SCRIPT>
END_SCRIPT
print ${cgi}->end_html();
exit( 0 );
callServer places an HTTP request to the specified page on the server. If you want to control the UI, return JavaScript int he body of the HTML page.
GodBlessMe
I'm calling the test.ipl in the onSaveDone event.
IWEventRegistry.addFormHandler( "onSaveDone", SaveFormDone);
__________________________________________________
function SaveFormDone(){
var parameters = new Object();
parameters.iw_workarea = "/default/main/myBranch/WORKAREA/wa";
alert(dcrName);
parameters.iw_file = "templatedata/Category/Type/data/" + dcrName;
IWDatacapture.callServer( "/iw-bin//test.ipl", parameters, true );
return( true );
}
_________________________________________________
test.ipl is as below:
_________________________________________________
use Shell;
use CGI;
my $in = new CGI;
my $myArea = $in->param('iw_workarea');
my $myDCR = $in->param('iw_file');
system("/home/iw-home/datadeploy/bin/iwdd.ipl cfg=/home/iw-home/custom/config.cfg myarea=$myArea myfilelist=$myDCR deployment=DeployDCR ");
In my case, I dont want callServer to return anything. I just want it to call the test.ipl once the Datacapture form is saved and close the Datacapture form.
Thanks.
GodBlessMe
It works now....
Thanks.