• itsaws
  • NEWBIE
  • 0 Points
  • Member since 2013

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

Hi folks,

 

Please help me to understand the isExecuting() context variable in Apex trigger with an Example ?

 

Regards,

Sonu

Hi folks,

 

I am passing my username thrugh url using encrption.But during fetching of url(from second page) it is unable to decrpt username.Please help me on this.Follow the below code which aceess the "https://c.ap1.visual.force.com/apex/MySecondPage?username=r+6QYqHGBsbrkKDopBSy6i3v2JykazW2+C4YBSoK5Z4%3D" url from second page.

                               public String Valueone{get;set;}

                               Valueone = ApexPages.currentPage().getParameters().get('username');
                               Blob b64dcrypted = EncodingUtil.base64Decode(Valueone);
                               Blob cryptoKey = Crypto.generateAesKey(128);
                               Blob decryptedData = Crypto.decryptWithManagedIV('AES128', cryptoKey, b64dcrypted);
                               System.debug('>>>>>>>>>>>>>>>>>>>>>>>>>>>>' + decryptedData.toString() );

this codd shows me the following message.(Even I have pass algorithmName as AES128,AES192,AES256 but facing same problem)

System.SecurityException: Input length must be multiple of 16 when decrypting with padded cipher .

 

Regards,

Itsaws11

trigger Trigger_ValidateGrandTotal on Account (before update) {
public decimal GrandtotalLimit=0;
Admin__c adminvar = [select Grand_Total_Limit__c from Admin__c where Name='CallPlan' and ownerId= :UserInfo.getUserId()  ];
GrandtotalLimit=adminvar.Grand_Total_Limit__c;

     for( Account acc:trigger.new)
     {
    
              if(acc.Grand_Total__c > GrandtotalLimit)
              {
                  
                  acc.addError('You have exceeded the limit of '+GrandtotalLimit+' for Account '+acc.name+'. Please review and modify the allocation');
                 
                  break;
                    
              }                
     }

I have 2 objects (A & B) related using Lookup relationship and I have a trigger on after insert on object A which creates record on object B. - Upto this stage everything is working fine. My issue is - I have the following fields in object A -

 

  1. Number of Installments
  2. First Installment Date
  3. Total Amount Due

If a user enters Number of Installments as 4, First Installment Date 5/15 and Total Amount Due $4000.00

Then

I would like to divide Total Amount Due by Number of Installments ($4000/4=$1000) and create 4 records of $1000 each in the object B. Also, the Payment Due Date in object B should set to 5/15, 6/15, 7/15 and 8/15.

 

Any help would be appreciated. Thanks.

  • May 08, 2013
  • Like
  • 0

Hi everyone;

 

How can I access (retrieve)  the name of the account owner using the name of the account. 

 

I found that account is in look up relationship with User , So running this query results in an error

 

 a) String acctname= [select Owner from account where name=: objAccount.Name];

 

 

Error: MyController2 Compile Error: No such column 'Owner' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. at line 16 column 22

 

 

 

b) String acctname= [select a.$User.FirstName from account a where a.name=: objAccount.Name];

 

Error: MyController2 Compile Error: Didn't understand relationship '$User' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 16 column 22

 

Thanx in advance !!