You need to sign in to do that
Don't have an account?
Thomas Panni
Automatic Asset Creation on Opportunity or Quote close
Hi out there,
I an absolute Apex beginner and would like to solve a problem: Once an opportunity is closed won the products from that opportunity should automatically become assets for that customer. I know I need a trigger, a class and a test class. So in general my idea is as follows:
if opp stage = closed won
and if opp has products
for each product (opp-line item)
create asset
with account ID...
set asset name = product name
etc...
How can I solve this? Where could I find appropriate code samples? Any help is pretty welcome...
So thanks in advance...
best regards Thomas
I an absolute Apex beginner and would like to solve a problem: Once an opportunity is closed won the products from that opportunity should automatically become assets for that customer. I know I need a trigger, a class and a test class. So in general my idea is as follows:
if opp stage = closed won
and if opp has products
for each product (opp-line item)
create asset
with account ID...
set asset name = product name
etc...
How can I solve this? Where could I find appropriate code samples? Any help is pretty welcome...
So thanks in advance...
best regards Thomas
p.s. one place that might provide you some background learning is over at sfdc99.com (http://www.sfdc99.com/beginner-tutorials/).
I am looking to do exactly the same with one small change - I want to generate an asset for each line item when the quantity is >1. Have you had any luck with it as yet? I found an app on the appexchange that does almost everything I need, except this and adding a location in, so if anyone has any thoughts on the best way to code this would be appreciated - I also am very new to salesforce development, but have some coding experience, so hopefully the learning curve is not large.
Have you had any luck with this trigger?
Thanks!
There are a few problems reported in the review comments, but most people like it. Remember, there is not a lot of support for this, but it is easier than writing your own code.
Still, it may not handle everything correctly. For instance, you may have products that you do not want an asset for, say a product like Installation or Training. It would be good to create a check box on the product - Create Asset. Then assets would be created only products where the box is checked.
Another enhancement would be parent and child assets. The current code does not handle this at all.
But it is a good start.
thanks a lot for that one. I will try it within the next weeks. It is a real good starting point. Let's see if I can handle or adopt the code in terms of the check box you suggest. Will let you all know...