Post

3 followers Follow
0
Avatar

Custom Action to Copy an Expense Sheet (with expenses)

I would like to copy an expense sheet to a new expense sheet. (since you can't save one as a template).

I created a custom action for "New Item" to:

Run On: CurrentObject

NewObject1= New Expense Sheet

$Description(Optional)

But, for Expense Sheets, there isn't a "Template / Source Object (Optional) =" like there is for a project.  Same with Expenses.

I was told you could do this with a workflow rule... 

Please help,

Thanks!

Gina Cargile Answered

Please sign in to leave a comment.

11 comments

0
Avatar

Hello Gina,

It is possible to do that. Please follow the steps:
1) Create a Custom Action on Expense Sheet entity.
2) That Custom Action should take a Project name as input (Project where a copy of Expense Sheet needs to be created).
3) Create a new Expense Sheet on the inputted Project.
4) Create a new Expense (run on $Expenses instead of CurrentObject()) on previously created Expense Sheet. This will force the action to iterate over all Expenses on current Expense Sheet.
5) Choose fields you want copied over.

Please let me know if this helps.

Roland Pumputis 0 votes
Comment actions Permalink
0
Avatar

Instead of a Project name, you can choose a project as input.

Just select an input type as "Reference to Object" of type "Project" + check "Mandatory" on the input variable.

Armand BOLMONT 0 votes
Comment actions Permalink
0
Avatar

I am not sure how to do #3... and how it knows what "Expense Sheet" I want copied based on the steps you provided.

Here is what I have... The only thing I can add for the expense is a description.  ?

Thank you!

Gina Cargile 0 votes
Comment actions Permalink
0
Avatar

Just click on the link "Another Field..." above the "Check Syntax" button to see the available fields.

Armand BOLMONT 0 votes
Comment actions Permalink
0
Avatar

I selected the External ID and entered the external ID to copy and got the error below... (I assume because that is setting it to and not copying from).

 

 

Gina Cargile 0 votes
Comment actions Permalink
0
Avatar

If I select Project for the additional field- it does work  - but creates 10 separate expense sheets:

Gina Cargile 0 votes
Comment actions Permalink
0
Avatar

ExternalID is the unique identifier of the object (so, if you use the one from the project, you get your error).

Here is a screenshot of what the Custom Action should look like (wasn't able to test it, but this should work). Roland, you could confirm that this is what you had in mind.

For the example, I used "Approver" as other field for example. I set the Project from the input variable (there is no $ on variable name). No relation fields are duplicated, to do so, I think you'll have to replicate the principle of duplicating Expense items.

Armand BOLMONT 0 votes
Comment actions Permalink
0
Avatar

Hm, it overwrote all the entries in the original TEMPLATE - Expense Report with "TEST"... It did create a new one with the same name, but without any expenses in it.  

Gina Cargile 0 votes
Comment actions Permalink
0
Avatar

Are you sure the old expenses were modified? I see a mistake in what I previously posted, but if I'm right, the new expenses should be added to the "Template" Expense Sheet in what I posted.

If the new expenses are just created under the wrong Expense Sheet (and the original one are not modified), just change this (ExpenseSheet field to "NewObject1"):



Armand BOLMONT 0 votes
Comment actions Permalink
0
Avatar

I created a new template expense because the original one was really acting weird... This time it duplicated the entries in the original template to copy from (except for the category).  So, it somehow thinks the expense portion of it is the original and not the copy.

Gina Cargile 0 votes
Comment actions Permalink