Skip to Content
0

Expense Report - Approve by ABSL Script

Oct 19, 2016 at 12:21 PM

277

avatar image

Hi All,

I need to approve the Expense report via ABSL script.

Is it possible? I already succeed with TimeSheet. So that I tried with an expense. But I am getting an error as "Process Instance not found for BO .ID".

Scenario: Expense record is coming from web service (Third Party SW).In ByD, This record should save with Status as "Approved".

Please help me to solve this problem? Otherwise is there any alternative solution to fulfill this requirement?

var description;
var IsCreatedByWebservice = false;

//This blog is indicate that the record is coming form Webservice
if (!this.Description.IsInitial())
{
	description = this.Description;
	var findSeprator = description.Find("~WS~");
	var findSepratorString = findSeprator.ToString();
	if (findSepratorString != "-1")
	{
		IsCreatedByWebservice = true;
		this.Description = description.Substring(findSeprator + 4);
	}
}

if (IsCreatedByWebservice)
{
  if(this.Status.SubmissionStatusCode != "2")
  {
    this.Submit();
  }
  if(this.Status.AuditStatusCode != "2" && this.Status.AuditStatusCode != "5" )
  {
    this.AcceptExpenseReport();
  }
  if(this.Status.ApprovalStatusCode == "3")
  {
   this.Approve("testing");
  }
}
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Pradeep Kumar N
Oct 20, 2016 at 02:57 AM
1

Hi Sankaran,

It looks like the current Expense instance doesn't have associated approval instance.

So, you could retrieve and check if Approval exists on the current instance before calling Approve.

Thanks, Pradeep.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Pradeep,

Thanks for your reply. But as soon as I submit the expense, the status will be changed to "Approval is pending".

Without Approval instance how the status changed like this? and as you said, Where should I check approval instance (BO)?

If it is wrong, please correct it.

Regards,

Sankaran A.

0
Horst Schaude
Oct 20, 2016 at 08:49 AM
0

Hello Sankan,

You can not set the value of a status variable direct in a BeforeSave snippet.

This can only be done in a Status Action.

HTH,
Horst

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Thanks Horst,

Is there any alternative solution to fullfil this requirement . I raised an incident. But it is talking exclusively long.

Regards

Sankaran A

0

Hello Sanjaran,

Instead of setting the value direct in the ABSL simply call the resp. action.
That should not be difficult. :-)

HTH,
Horst

1
Pradeep Kumar N
Oct 21, 2016 at 02:51 AM
0

Hi Sankaran,

If the status is getting changed, then there should be no issue.

Thanks, Pradeep.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Pradeep

We can't change status directly . The field doesn't have PSM release. That is the reason , I'm trying to trigger all the actions.

Thanks

Sankaran

0