• VVKrishna
  • NEWBIE
  • 35 Points
  • Member since 2012

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

I am having a hexadecimal value of 32 characters which I am storing in String(as salesforce do not have any data type for hexadecimal). When I am converting this String to Blob and using the blob for encryption, the blob size is changed to 32Bytes (each character is been considered as 1 byte unlike the regular hexadecimal where 2 characters make a byte). Can any one please let me know how to store hexadecimal values in Salesforce and how to convert it accordingly so that the size does not change. Or do we have any way to convert it to blob where we get only 16bytes instead of 32 bytes

Hi,

 

I have written a trigger on the agreement object to close the cases related to the agreement.

 

When I am doing any other update on the agreement, the trigger is throwing the error

 

Too many SOQL queries.

 

It used to work good until today. I don't know the reason for this error.

 

please find the trigger here

 

trigger CloseCase on pb__Agreement__c (before update) {
//List<ID> accIds = New List<ID>();
List<ID> agIds =New List<ID> ();
for(pb__Agreement__c ag:Trigger.new){
if(ag.pb__AgreementType__c == 'Sale' && ag.Stage__c == 'Transaction Closed'){
agIds.add(ag.Id);
}
}
List<Case> c = [ SELECT id,Agreement__c,Status, RecordTypeId from Case where Agreement__c = :agIds and RecordTypeId = '012A0000457547' LIMIT 2];
if(c.size() > 0){
Case cs = c[0];
c[0].Status = 'Closed';

}
update c;
}

 

 

Please help me.

 

Thanks and Kind Regards

 

Finney

  • November 07, 2013
  • Like
  • 0

I am having a hexadecimal value of 32 characters which I am storing in String(as salesforce do not have any data type for hexadecimal). When I am converting this String to Blob and using the blob for encryption, the blob size is changed to 32Bytes (each character is been considered as 1 byte unlike the regular hexadecimal where 2 characters make a byte). Can any one please let me know how to store hexadecimal values in Salesforce and how to convert it accordingly so that the size does not change. Or do we have any way to convert it to blob where we get only 16bytes instead of 32 bytes

I have written below APEX trigger to update contact address whenever contact account is changed. Code is working but when i am using data loader to update other fields they are not updating and getting this error; i am trying to update a field which is not used in trigger. Any help will great, thanks in advace

 

Error

------

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY:UpdMailingAddress: execution of BeforeUpdate

caused by: System.NullPointerException: Attempt to de-reference a null object

Trigger.UpdMailingAddress: line 17, column 1

 

Trigger

----------

trigger UpdMailingAddress on Contact (before update)
{

Set<Id> parentIds = new Set<Id>();
for(contact c : trigger.new)
{
parentids.add(c.accountid);
}

map<id, account> accountid = new map<id, account>();
accountid.putall([select Id,billingCity,billingCountry, billingPostalCode,billingState, billingStreet from account where id in :parentIds]);

for(contact c:trigger.new)
{
c.mailingcity=accountid.get(c.accountid).billingCity;
c.mailingCountry=accountid.get(c.accountid).billingCountry;
c.mailingPostalCode=accountid.get(c.accountid).billingPostalCode;
c.mailingState=accountid.get(c.accountid).billingState;
c.mailingStreet=accountid.get(c.accountid).billingStreet;

}
}

Hi ,

  I developed a visualforce page with date field. when i opened this page the date picker popup opened default from date field. i need to just hide this popup if i click that textbox need only open this popup..Have you any solution for this.

 

Thanks

Rajii

 

Hi,

 

We tried to implement a single sign on mechanism of a third party web solution using the Crypto.encrypt method. The third party solution requires that the initialization vector is XOR encoded into the first 16 bytes of the transmitted SSO Token. In java this would be done like this:

 

 

for (int i = 0; i < 16; i++) {
   data[i] ^= INIT_VECTOR[i];
}

 

 

where data and INIT_VECTOR would be byte arrays. In Apex there's nothing like a byte array and Blob has no methods at all. The XOR operator ^ does exist in Apex but it can only be used with Boolean expressions and Integers. So I can't just use the Strings and do some wild XOR character operations. Does anybody know how I can implement an XOR encryption like in Java or any other programming language using Apex?

 

Thanks for your help and best regards,

Henry