on 05-29-2012 7:51 AM
Hi all,
we need to check if workflow will be enhanced so that the user need to upload signed contract to the system allowing user to progess to contract phase from "Approved contract" to "Signed contract".
If contract is not uploaded it should not enhanced to "signed contract phase".
1>Do we need to create a separate workflow between the phase "Approved contract" and "Signed contract" to check for uploaded contract
please guide me how to go through this.
your inputs are valuable.
regards
pallavi
Hi Pallavi,
There is event hook call Pre-Phase in the Document Event Lifecycle Events. This hook is mainly used to perform validation checks before proceeding to the concerned phase.
You can write a script in this hook to check if the contract document has been uploaded.
Use method getDocVersions() to retrieve the active version of the contract docuement file (.doc file). If this method returns a null value raise an exception which will prevent the phase change.
Thanks,
Arijeet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arijeet,
Thanks for your valuable inputs.
from your rply i got that we just need to write a script to perfrom validation checks before proceeding to next phase.
The class we going to select in script defination for the new script is "master aggreement"
but how will we check that the current phase is "Approved Phase" if it is approved phase check if ----> user has uploaded signed contract document---->if user has not uploaded the signed contract document prevent phase from enhacing to next phase i.e"signed contract"
can you provide some scripts for the same.It would be helpful
your inputs are appreciated
Regards,
Pallavi
Hi Pallavi,
As per your process the phase will be changed from Contract Phase->Approved Phase-.>Signed Contract. There are two possibilities to this solution:
contract_doc = doc.getVersion();
iter = contract_doc.iterator();
if(!iter.hasNext()){
//Raise Exception
else
if(doc.getApprovalStatus() == APPROVED){
doc.getIBeanHomeIfc().upgradeToEdit(doc);
doc.getIBeanHomeIfc().changePhase(doc,"Signed Contract");
}
In option one in while scripting the Pre-Phase hook there are certain system variable that you can use. The two variables that you need to use are @phase_advancing (denotes advancing of phase) and @other_phase (string variable that contains the target phase which in your case is Signed Contract). Unless the validation check is successful the phase will not get advanced to the phase mentioned in @other_phase.
I hope this clears your doubts.
Thanks,
Arijeet
Hi Arijeet,
The first possibility you mention is the requirement..
When you configure your workflow make sure that you don't transition the phase automatically to Signed Contract (adjust the postscript).
My question is how to adjust the postscript??
After approval once the user tries to change the phase to Signed Contract the script will be called and the validation check will be performed.
This call script is the once you mention above..??
1>The script called should first chect that the current phase is "Approved contract" --->
If it is "Approved contract phase" it should check whether the user has uploaded signed contract document or not--->if yes proceed to next phase i.e "signed contract"
Thanks Arijeet for your valuable inputs
Regards,
pallavi
The code you have mention above above will it work for this condition and where is it checking for current phase in it???
Hi Pallavi,
In that case you will have to handle everything in the pre-pahse script as I menationed above. Apart from the system variables mentioned above there is another system variable called @phase which contains the ID of the current phase.
Using @phase you can check your current phase.
Note: The code I mentioned above is for the post script, but you can use the part where it checks for the existence of contract documents.
contract_doc = doc.getVersion();
iter = contract_doc.iterator();
if(!iter.hasNext()){}
Thanks,
Arijeet
Hi Pallavi,
Also another point.
In the post script do not code the logic for automatically advancing the phase to Signed Contract.
As per our discussion the phase advancing should be manual after the validation check are performed in the Pre-Phase Script.
Let me know how the solution works out for you.
Thanks,
Arijeet
Hi Arijeet,
Thanks for your valuable input.
In prescript for "Approved Contract" we will do all the condition checking like contract document is uploaded or not, if yes contract is uploaded then it will go to postscript of "approved contract"???...right!!
In th postscript for "Approved contract" we will advance the phase to last stage "signed contract"
or as per your above rply we wont code any logic in postscript for advancing to next phase ie "Signed contract"
This is a doubt I have
One more question is there any need for workflow between the two phases approved contract and signed contract???
reagrds,
pallavi
Hi Pallavi,
I'll try and break down the solution for you.
Firstly, lets be clear on one point. The workflow logic (adding approvers) will be coded in the prescript of the XPDL file while the validation checks will be done via scripts.
I assume that the XPDL is working fine and the approvers are getting added.
For the validation we have to create a script through Setup->Integration->Script Definition.
The scripting context will be Document Lifecycle Event and the target will be Pre-Phase change. The validation check will be written within this script.
So your process flow would be:
Note: Just a thought, but according to me you do not need this development since contract document file is a mandatory field while creating a contract. Usually this development is useful for carrying out other validations like checking if an approver is added to the Master Agreement or not.
I hope I have answered your question.
Thanks,
Arijeet
Hi arijeet,
1>we need to check if status is approved contract(highlighted in red ) ---->this is first check we need to perform.
2>Check if user has uploaded signed contract document i.e we need to check the attachement.if it is there go to last phase ie signed contract phase.
I hope the the solution provided by you will work.
If you have any other piece of code( script) do share.
thanks for you time and input.
regards,
pallavi
Hi Raj,
Please try below code
String CLASS_NAME = "Document Validation";
String ERR_MES = "No File Attached";
//check the phase then you can procedd with the code
IBeanFieldMdIfc cont = (IBeanFieldMdIfc)doc.getFieldMetadata("SIGNED_DOC");
//SIGNED_DOC is the technical filed name for attachment
AttachmentIfc attachClObj = (AttachmentIfc)cont.get(doc);
if( attachClObj == null )
{
throw doc.createApplicationException(null,CLASS_NAME,ERR_MES);
}
Regarrds,
Pallavi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.