• I don't know. I just work here
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

Any efficient way other than this?

 

trigger AutoAssignOpportunityNumber_AutoNoObj on Opportunity (before insert) {

   for (Opportunity o : Trigger.new)

 

{

       // Iterate over each sObject

        AutoNo__c au = [select NextNo__c, Iterator__c from AutoNo__c where Category__c = 'Opportunity Number' LIMIT 1 FOR UPDATE];

       if (o.Opportunity_Number__c == '' || o.Opportunity_Number__c == NULL)

        {

          while ([select count() from Opportunity where Opportunity_Number__c =:au.NextNo__c] > 0) {

                au.Iterator__c = au.Iterator__c + 1;

               // reflush the formula field

                update au;

                au = [select NextNo__c, Iterator__c from AutoNo__c where Category__c = 'Opportunity Number' LIMIT 1 FOR UPDATE];  <--- MUST RELOAD???

            }

            o.Opportunity_Number__c = au.NextNo__c;

            au.Iterator__c = au.Iterator__c + 1;

            update au;

        }

    }

}

Hi

Is it possible to write a formula that essentially breaks the shipping address down into the individual lines?

We have an external system that needs to receive the address fields for a child object to an Account in three separate fields.

I figure if I can identify a new line character, then this should be pretty straight forward, but I can't figure out how to do this.
Any ideas?

thanks
Nick