You need to sign in to do that
Don't have an account?
adiaz
Create new entry in a different object
I created 2 custom objects as a logging tool; Suppor Ticket and Maintenance Requests.
I have a field called type in the maintenance object. I would like a new entry to be created in the support ticket object if the field Type (in maintinance object) is changed to Support Required. Is this possible without Apex coding?
I dont know whether you still require answer for this or not.
If yes then use the below code and replace accordingly with your details.
trigger <<triggername>> on Maintainance__c(after update)
{
if(Trigger.isUpdate){
for(Maintainance__c m: Trigger.new)
{
if(m.Type__c == 'Support Required')
{
SupportTicket__c st = new SupportTicket__c();
//do your stuff, for ex
st.xyz = m.xyz;
insert st;
}
}
}
}
Let me know if you have any questions.
All Answers
I do not believe so. You would have to write an Apex Trigger.
It can not be achieved through standard functionality, you need to create a trigger for that.
Thanks for the reply. I have very little apex code knowledge. Can someone point me in the right direction? perhaps a similar code where i have to replace fields/objects name? Thanks
I dont know whether you still require answer for this or not.
If yes then use the below code and replace accordingly with your details.
trigger <<triggername>> on Maintainance__c(after update)
{
if(Trigger.isUpdate){
for(Maintainance__c m: Trigger.new)
{
if(m.Type__c == 'Support Required')
{
SupportTicket__c st = new SupportTicket__c();
//do your stuff, for ex
st.xyz = m.xyz;
insert st;
}
}
}
}
Let me know if you have any questions.
Works perfectly! Thanks!
Okay I've written my code and tested it in my sandbox; works as expected. When I tried to move it to production, I ran a the deployement test and I received the following msg: "Coverage of selected Apex Trigger is 0%...." I browsed the boards for an answer but everything I tried didn't work. Can someone help me write a test class?
Below is my Trigger Code: