• Bhanu joshi 10
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 9
    Questions
  • 16
    Replies
I am trying to create a signed URL to download file from Google Cloud .
I am geeting the following error
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>
The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.
</Message>
 </Error>

Any help to resolve this is helpful
thanks
How to determine , to whom a record is shared . Like i have a account records. I would like to know to which users this record is shared ...
I know i need to check sharing settings etc . But other way to accomplish this
"FIND {"Joe Smith" OR "Joe Smythe"}
IN Name Fields
RETURNING lead(name, phone), contact(name, phone)" 
when i am running this query from developer console on "ExecuteAnonymousWindow" .
I got the following error: 
"Unexpected token '<'."
any help on this?
thanks in advance
I have a custom picklist with country name in custom object.
Now i have to update the api name of picklist value to ISO format (i.e India to IND), without loosing the old data.
Any help !!!
Thanks 

Iam  not getting any entry under "Outbound Messaging Delivery Status", when i send outbound message .
And in the debug log it is showing no error.

IS "Outbound Messaging Delivery Status" only show the status for Error/ Fail Messages?
 

I am trying to access a photo in S3 bucket using a signed url like below:
String url = 'https://'+BucketName+'.s3.amazonaws.com/'+filename+'?AWSAccessKeyId='+AccessKey+
   '&Expires='+Lexpires+'&Signature='+signed;
its works fine for me.
But how can i access a photo from inside a folder..
Structure is like :   S3--bucket(b1)--folder(f1)-img1.jpg
If iam using following url 
String url = 'https://'+BucketName+'/f1.s3.amazonaws.com/'+filename+'?AWSAccessKeyId='+AccessKey+
   '&Expires='+Lexpires+'&Signature='+signed;
Getting the error.
Please let me know how can i access the image inside a folder. I have give permission to user.

Hi 
Iam running following cod from developer console 
Account acc = new Account();
acc.RSPO_AC__c = '01';    //  datatype is   Text(50) (External ID)
acc.RSPO_EMPLOYEE__c=true;
update acc;
Iam getting following error:
System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []
IS that possible to update record using soql via external instead of Salesforce id.
Thanks

I have written following Code
integer count  0;
condition 1:
for(Account a :[Select name from account limit 10]){
count++;
System.debug('Count   '+count);
}

condition 2:
​for(list<Account> a :[Select name from account limit 10]){
count++;
System.debug('Count   '+count);
}

On condition 1 i get output as 10 and for condition 2 i  get output 1.  Why?
Any help will be appricated
Thanks
I am calling a class that is using tooling API to update validation rule from BATCH CLASS.
I am getting user session id as null.

        req.setHeader('Authorization','Bearer '+UserInfo.getSessionID());   // here iam getting null
         req.setHeader('Content-Type', 'application/json');
         req.setHeader('Content-Length', '0');

and when i run class from developer console , all works fine.
Please let me know how to fix this ?
Thanks
How to determine , to whom a record is shared . Like i have a account records. I would like to know to which users this record is shared ...
I know i need to check sharing settings etc . But other way to accomplish this
"FIND {"Joe Smith" OR "Joe Smythe"}
IN Name Fields
RETURNING lead(name, phone), contact(name, phone)" 
when i am running this query from developer console on "ExecuteAnonymousWindow" .
I got the following error: 
"Unexpected token '<'."
any help on this?
thanks in advance
I have a custom picklist with country name in custom object.
Now i have to update the api name of picklist value to ISO format (i.e India to IND), without loosing the old data.
Any help !!!
Thanks 

Iam  not getting any entry under "Outbound Messaging Delivery Status", when i send outbound message .
And in the debug log it is showing no error.

IS "Outbound Messaging Delivery Status" only show the status for Error/ Fail Messages?
 

Hi,
I need to have a trigger to update 'Rating' of an Account to 'Cold', if it's related opportunity is staged to 'Qualification'.
We should use MAP here.

I have tried the below code. But, it is not updating the record of account

trigger mapAccount on Opportunity (before insert,before update) {
    
    List<Opportunity> ol=[select id,Account.rating from Opportunity where id in: Trigger.new and StageName='Qualification'];
    Map<ID,Opportunity> mp=new Map<ID,Opportunity>();
    System.debug('----------');
    
    for(Opportunity o:ol){
        o.Account.rating='Cold';
        mp.put(o.id, o);
        System.debug('Rate--'+o.Account.rating);
    }
    System.debug(mp.values());
}

Could someone help me.
Hi..... All
I am trying to fetch the data from Opportunity and display in vf page,But i am facing this Error any one can help me.
[(apex Error) Invalid type: Schema.oppotunity     (VF page Error) Unknown property 'SOQL_Ex2.lopty']
VF Code:
<apex:page controller ="SOQL_Ex2">
    <apex:form>
        <apex:pageBlock  title ="SPQL_Ex2">
            <apex:pageBlockTable value="{!lopty}" var="op">
                <apex:column value="{!op.name}"/>
                <apex:column value="{!op.stagename}"/>
                <apex:column value="{!op.closedate}"/>

            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Apex Class:
public class SOQL_Ex2 
{
    public list<Opportunity> lopty {get;set;}
    public SOQL_Ex2()
    {
        lopty=[select Name,StageName,CloseDate from oppotunity];
    }
}
I have written following Code
integer count  0;
condition 1:
for(Account a :[Select name from account limit 10]){
count++;
System.debug('Count   '+count);
}

condition 2:
​for(list<Account> a :[Select name from account limit 10]){
count++;
System.debug('Count   '+count);
}

On condition 1 i get output as 10 and for condition 2 i  get output 1.  Why?
Any help will be appricated
Thanks
Here Is my class :
public with Sharing class VisitReportpdf{

Public sic_Visit_Report__c VisitReport{get;set;}
Public VisitReportpdf(apexpages.standardcontroller controller){
VisitReport= [SELECT 
                   id,
                   Name,
                   CreatedBy.name,
                   Our_shares__c,
                   Market_Share__c,
                   Total_demand__c,
                   Visit_title__c,
                   Visit_Date__c,
                   Account__r.name,
                   Competitors__c,
                   Contact__r.name,
                   Internal_Participants__c,
                   Objective__c,
                   Report_details__c                   
               FROM Visit_Report__c 
               where id=:ApexPages.CurrentPage().getparameters().get('id')];
}
}

And this is my Test Class
@isTest(SeeAllData=true)
public Class TestVisitReportpdf{
  public static testmethod void test1(){
   
   Account acc= new Account();
   acc.name ='TestAccount';
   Insert acc;
   
   Contact con = new Contact();
   Con.lastName='Test Contact';
   Con.Accountid=acc.id;
   Insert con;
   
    Visit_Report__c svr = new Visit_Report__c();  
    svr.Account__c=acc.id;
    svr.Competitors__c='test Competitors';
    svr.Contact__c=con.id;
    svr.Visit_Date__c=system.today();
    svr.Internal_Participants__c='Test Participents';
    svr.Our_shares__c=10;
    svr.Market_Share__c=90;
    svr.Total_demand__c=100;
    svr.Objective__c='Commercial';
    svr.Report_details__c='Test Report Details';
    svr.Visit_title__c='Test visit Title';
    Insert svr;  
   

        
    
  ApexPages.Standardcontroller sc = new ApexPages.Standardcontroller(svr);
  VisitReportpdf VRP= new VisitReportpdf(sc);
 
      
 }
}

I am calling a class that is using tooling API to update validation rule from BATCH CLASS.
I am getting user session id as null.

        req.setHeader('Authorization','Bearer '+UserInfo.getSessionID());   // here iam getting null
         req.setHeader('Content-Type', 'application/json');
         req.setHeader('Content-Length', '0');

and when i run class from developer console , all works fine.
Please let me know how to fix this ?
Thanks
Hi all,

I am pasting below my apex class and test class. I am getting accID as null. Please help me where i am going wrong.
apex class----------------------

public class DisplayNotesNew{

public List<WrapperClass> listWrapper {get;set;}
public List<ContactWrapper> listWrapper1 {get;set;}
public List<OpportunityWrapper> listWrapper2 {get;set;}
public Id accId;
Public Account acc;
public List<Note> selectedNotes{get;set;}
public List<Contact> selectedContacts{get;set;}
public List<opportunity> selectedOpps{get;set;}
List<note> contactNote = new List<note>();
List<note> oppNote = new List<note>();
public ID noteID {get;set;}
Public String getRadioValue{get;set;}

public void assignNoteId() {
   Id note = ApexPages.currentPage().getParameters().get('note');
   system.debug('18-->'+note );
   if(note != null) {
      noteID = note;
   }
}    

public DisplayNotesNew(){
        
}
public DisplayNotesNew(ApexPages.StandardController Controller) {

accId = ApexPages.currentPage().getParameters().get('id');
system.debug('********accId************'+accId);
  
List<Note> listAcct = [SELECT Id,Title, Body,Parent.Id,CreatedDate FROM Note where Parent.Id =: accId order by ID DESC];
    system.debug('listAcct--------------------'+listAcct);
  if(listAcct.size() > 0) {  
      listWrapper = new List<WrapperClass>();      
      for(Note a : listAcct) {        
          listWrapper.add(new WrapperClass(a));
        }
    }
List<Contact> listContact = [Select Id, FirstName, LastName,name From Contact where AccountId =: accId order by name DESC];
    if(listContact.size() > 0){     
        listWrapper1 = new List<ContactWrapper>();          
        for(Contact c : listContact){            
            listWrapper1.add(new ContactWrapper(c));
        }
   }

List<Opportunity> listOpp = [select id,name,closeDate from Opportunity where AccountId =: accId order by closeDate ASC];
    if(listOpp.size() > 0){  
        listWrapper2 = new List<OpportunityWrapper>();             
        for(Opportunity o : listOpp){              
            listWrapper2.add(new OpportunityWrapper(o));
       }
   }
}
public pagereference assignNotes(){
system.debug('******noteID******'+noteID);
Note no = [select id,title,body,parentId from Note where id=:noteID limit 1];
system.debug('********no******'+no);

/*selectedNotes = new List<Note>();
system.debug('*********listWrapper ********'+listWrapper);
for(WrapperClass wrapAccountObj : listWrapper ) {
     if(wrapAccountObj.checkBool == true) {
        selectedNotes.add(wrapAccountObj.acct);
        system.debug('*********selectedNotes********'+selectedNotes);
     }  
}  */

selectedContacts = new List<Contact>();
 for(ContactWrapper wrapContactObj : listWrapper1){   
     if(wrapContactObj.checkBool == true){
         Note nt = new Note();  
         nt.Title = no.title;
         nt.Body = no.body;
         nt.ParentId = wrapContactObj.cons.Id; 
         contactNote.add(nt);
         //selectedContacts.add(wrapContactObj.cons);
         //system.debug('*********selectedContacts******'+selectedContacts);
       }
    }
insert contactNote;
    
selectedOpps = new List<Opportunity>();
  for(OpportunityWrapper wrapOppObj : listWrapper2){  
      if(wrapOppObj.checkBool == true){  
          Note nt = new Note(); 
          nt.Title = no.title;  
          nt.Body = no.Body;
          nt.parentId = wrapOppObj.ops.Id;
          oppNote.add(nt);
          //selectedOpps.add(wrapOppObj.ops);
         // system.debug('******selectedOpps*********'+selectedOpps);
     }
  }
insert oppNote;
  PageReference pg = new PageReference('/apex/DisplayAccountNotes?id='+accId);  /*Redirect on the same page*/  pg.setRedirect(true); return pg; 
}
public class WrapperClass{
   public Boolean checkBool {get;set;}
   public Note acct {get;set;}
   public WrapperClass(Note acct){
        this.acct = acct;
        checkBool = false;
       }        
    }
public class ContactWrapper{
   public Boolean checkBool {get;set;}
   public Contact cons {get;set;}
   public ContactWrapper(Contact cons){
        this.cons = cons;
        checkBool = false;
        }    
     }
public Class OpportunityWrapper{
   public Boolean checkBool {get;set;}
   public Opportunity ops {get;set;}
   public OpportunityWrapper(Opportunity ops){
        this.ops = ops;
        checkBool = false;
        }   
     }
}

Test Class-----------------------------------------

@isTest
public class DisplayNotesNewTestClass {

  static testmethod void test1(){
    
    Account acc = new Account(name='vivek112');
    insert acc;
   
    Note ne = new Note(parentid = acc.Id,body ='hi',title = 'Bye');
    insert ne;

    Contact con = new Contact(FirstName='vivek112', AccountId = acc.Id);
    List<Contact> lstcon = new List<Contact>();
    lstcon.add(con);   
        
    Opportunity opp = new opportunity(name = 'a',stageName = 'Closed Won',closedate = date.today(),Renewal_Date__c = date.today(),AccountId = acc.Id);
    List<Opportunity> lstopp = new List<Opportunity>();
    lstopp.add(opp);  
    system.debug('lstopp'+lstopp);
     
     Note note1 = new Note(parentid = acc.Id,title='test',body= 'hi');
    List<note> nList = new List<Note>();
    nList.add(note1);
   
    Note note2 = new Note(parentId = acc.Id,title = 'Hi',body = 'Hi');
    insert note2;
    system.debug('note2-------------'+note2);
    
  
    
    PageReference pageRef = Page.DisplayAccountNotes;
    Test.setCurrentPage(pageRef);      
    DisplayNotesNew obj = new DisplayNotesNew(new ApexPages.StandardController(acc));
    ApexPages.currentPage().getParameters().put('accId',acc.Id);
   // DisplayNotesNew controller = new DisplayNotesNew();
  	  Test.startTest();
 
    ApexPages.CurrentPage().getparameters().put('note',note2.Id);

    DisplayNotesNew objCustom = new DisplayNotesNew ();
    DisplayNotesNew.ContactWrapper objwrap = new DisplayNotesNew.ContactWrapper(con);
    DisplayNotesNew.OpportunityWrapper objwrap1 = new  DisplayNotesNew.OpportunityWrapper(opp); 
    DisplayNotesNew.WrapperClass objwrap2 = new DisplayNotesNew.WrapperClass(note1);
    Id accId = acc.Id;
    id note = note2.id;
    objCustom.assignNoteId();
    id noteID = note;
    objCustom.assignNotes();
    Test.stopTest();
    }
}

-Amita
How can I delete all the records of a custom object in Developer Edition?

I'm writing a trigger for new opportunity products to populate a field Product_Category__c (on opportunity lineitem) getting the value from Product_Category_new__c (on Product).

This is my trigger:

trigger SetProductCategory on OpportunityLineItem (after insert) {

            for (OpportunityLineItem opplineitem: Trigger.new){

                         opplineitem.Product_Category__c= opplineitem.PricebookEntry.Product2.Product_Category_new__c;

              }     
}

I get this error message:

execution of AfterInsert caused by: System.FinalException: Record is read-only

I have tried with before insert;in this case there aren't errors but the value Product category it's not saved on Opportunity Line item.

 

I have found that:

In a after insert trigger is not allowed change field using trigger.new

 

Please can you suggest a solution for this? i would like to copy the value Product category (Product) on Product Category (Opportunity Product) after the insert of the new opportunity products.

Thanks in advantage for any advice.

Br

Hi All,

 

I see the crypto class supports SHA1 only.

 

Is there any Apex library to generate a mac signature using SHA256 ?

 

Thanks

Hi,

As a newbie with regard to Outbound Messaging, I created an Outbound Message and a Workflow Rule in my developer account with one action (to send an Outbound Message) for leads whenever a lead was created or edited. With the endpoint (http://...../sf_listener.php) not yet in existence, I created a new lead, but no entry appeared in the Outbound Message Delivery queue. The documentation states "If the endpoint is unavailable, messages will stay in the queue until sent successfully, or until they are 24 hours old".  Is there a setting I missed - eg. to enable Outbound Messaging?

CG


While implementing emp API in LWC to subscribe the platform event I  find out that there is small issue in sample code snipit given in documentation.
Issue is in handleSubscribe method in js below is the code given in documentation:
handleSubscribe() {
        // Callback invoked whenever a new event message is received
        const messageCallback = function(response) {
            console.log('New message received : ', JSON.stringify(response));
            // Response contains the payload of the new message received
        };

        // Invoke subscribe method of empApi. Pass reference to messageCallback
        subscribe(this.channelName, -1, messageCallback).then(response => {
            // Response contains the subscription information on successful subscribe call
            console.log('Successfully subscribed to : ', JSON.stringify(response.channel));
            this.subscription = response;
            this.toggleSubscribeButton(true);
        });
    }
 Correction is required in messageCallback method which should be as below:
const messageCallback = (response) => {
        console.log('New message received : ', JSON.stringify(response));
        this.payload = JSON.stringify(response);
        console.log('this.payload: ' + this.payload);
        // Response contains the payload of the new message received
    };
We have to use arrow function as it does not have its own scope.