• Jeremy K
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I have 2 objects "Ticket and Ticket Item"  they have a master detail relationship with Ticket as master. I need to set up a number sequence by 10 on “ticket item”
 
The way I need it to work is every time a “ticket item” is added to a ticket is get a Sequence number starting at 10. The sequence would jump by 10 for each ticket item added to a ticket, so for example 10,20,30,40,ECT.
I also need the sequence number to reset for each ticket.  So every time a ticket item was added to a new ticket it would start at 10.  If a ticket items is deleted from the ticket the seq number does not change it stays the same for that ticket.

 
Here is how I kind of think the code should work.
 
On the object FX5__Ticket__c I have created a field called Starting _number__c it will default to zero on ever record created in FX5__Ticket__c
 
So I am going to write a trigger on the FX5__Ticket_Item__C that will fire after insert so I have a Record ID.
 
Get List of new records created in FX5__Ticket__c “ I think I can use trigger.new for this”
 
Now I need to somehow getting the starting number on the related FX5__Ticket__c record.
 
Then I need to do a FOR LOOP I think on all the records in Trigger.new
 
I need to get the Starting_Sequence_Number__c on FX5_Ticket_Item_C record that is related to FX5_Ticket_Item__C and +10 for each record writing it to SAP_Sequence_Number__c.
 
Then once all the related records have been update I need to take the count and update Starting_Sequence_Number__c on FX5_Ticket_Item_C with the value.
 
Any help would be great.
 
 
 
 
 
 
 
I have 2 objects "Ticket and Ticket Item"  they have a master detail relationship with Ticket as master. I need to set up a number sequence by 10 on “ticket item”
 
The way I need it to work is every time a “ticket item” is added to a ticket is get a Sequence number starting at 10. The sequence would jump by 10 for each ticket item added to a ticket, so for example 10,20,30,40,ECT.
I also need the sequence number to reset for each ticket.  So every time a ticket item was added to a new ticket it would start at 10.  If a ticket items is deleted from the ticket the seq number does not change it stays the same for that ticket.

 
Here is how I kind of think the code should work.
 
On the object FX5__Ticket__c I have created a field called Starting _number__c it will default to zero on ever record created in FX5__Ticket__c
 
So I am going to write a trigger on the FX5__Ticket_Item__C that will fire after insert so I have a Record ID.
 
Get List of new records created in FX5__Ticket__c “ I think I can use trigger.new for this”
 
Now I need to somehow getting the starting number on the related FX5__Ticket__c record.
 
Then I need to do a FOR LOOP I think on all the records in Trigger.new
 
I need to get the Starting_Sequence_Number__c on FX5_Ticket_Item_C record that is related to FX5_Ticket_Item__C and +10 for each record writing it to SAP_Sequence_Number__c.
 
Then once all the related records have been update I need to take the count and update Starting_Sequence_Number__c on FX5_Ticket_Item_C with the value.
 
Any help would be great.