• Durga Paavan
  • NEWBIE
  • 40 Points
  • Member since 2019

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 23
    Replies
Hi Every one,
I have one custom object in that am creating price field with currency data type and I enabled the multi-currency(Picklist).
whenever I selected USproof for above discussion dollar in the picklist and I trying to insert value with a dollar sign($) in price field it will throw an error like invalid currency field, and I want to replace this message with my own error message can u help me is it possible or not.

 
Hi Guys,

I have developed an Einstein Bot in Developer Edition and packaged it to upload in another org as part of packaging process. I have installed the created package in another org and getting "No Agents available" Error.
No Agents Available Error
Omni Channel is Available:
Omni Channel Available
Please note that I have configured both Live Agent , Omni Channel correctly as i am able to create, connect the bot in installed Org.

Help with this issue is higly appreciated!!.

Please let me know if you need more information.

Thanks.
Durgapaavan
I am new to Salesforce and trying to create formula to match two fields from two different objects. (Ticketbud_Event__r.Name and Ticketbud_Event__c).  If they match, return the value that is in the field Object: Ticketbud_Event__r.Ticketbud__External_ID__c, if not then enter "no match".  My formula is below but clearly is not working as shown by the screenshot.  Please can someone tell me what I am doing wrong!

IF(Ticketbud_Event__r.Name = Ticketbud_Event__c, Ticketbud_Event__r.Ticketbud__External_ID__c ,"no match")

User-added image
Hi Guys,

I have developed an Einstein Bot in Developer Edition and packaged it to upload in another org as part of packaging process. I have installed the created package in another org and getting "No Agents available" Error.
No Agents Available Error
Omni Channel is Available:
Omni Channel Available
Please note that I have configured both Live Agent , Omni Channel correctly as i am able to create, connect the bot in installed Org.

Help with this issue is higly appreciated!!.

Please let me know if you need more information.

Thanks.
Durgapaavan
Hi All,

I am trying to write test class for a class which makes HTTP callout  and returns response in wrapper. Below is my code

//Callout Class. This is a blurpint please avaoid syntax error

public class CalloutClass {

@AuraEnabled
public static wrapperClass CalloutMethod (string wslr){   //This method returna a wrapper

wrapperClass wrapper =new wrapperClass();

Http h=new Http(); 
HttpRequest req=new HttpRequest();
/*
Request Params
*/

HttpResponse res=h.send(req);

/*
Deserialize response
*/

if(res.getStatusCode()==200){
wrapper.Status=res.getStatus();
wrapper.StatusCode=res.getStatusCode();
wrapper.response=res.getBody();

}

return wrapper;
}


public class wrapperClass{

@AuraEnabled public string Status {get; set;}
@AuraEnabled public integer StatusCode {get; set;}
@AuraEnabled public list<object> response {get; set;}
}


}

//Mock Class

@isTest
public class MockCallout implements HTTPCalloutMock {

Public HTTPResponse respond(HTTPRequest Req) {
    HTTPResponse Res=New HTTPResponse();
    
    Res.setStatusCode(200); 
    Res.setStatus('OK');    
    //Res.setBody(); //callout response is list of objects so dont know how to set response here without line break 
    return Res;    
    }


}

//Test Class

@isTest
Public Class OP_TestAppointmentCallout {

@isTest 
public Static void TestAppointmentData(){


   Test.setMock(HttpCalloutMock.class,new MockCallout());   

 
    CalloutClass.wrapperClass Wrapper=CalloutClass.CalloutMethod('93411');
    
    String Actualstatus =Wrapper.Status;
    Integer Actualstatuscode =Wrapper.StatusCode;
    
    
    system.assertEquals('OK',Actualstatus);
    system.assertEquals(200,Actualstatuscode);
   
    }

}

When i run test i am getting Null pointer exception for test class. I am not sure how to set fake response in mock class and how to call actuall class in test class. Please help 
I am really trying to cover the forllowing batch with test class please help :

Batch class:

/*
Name: BatchOpportunitySnapshotReportCreation
Copyright © 2019 SAI Global

Purpose:CMPS-2557 On reporting on opportunity records by performing aggregation using multiple criteria
   
VERSION  AUTHOR            DATE             DETAIL                FEATURES/CSR/TTP
    1.0  Isha Saxena     17 July 2019         Inital Creation
*/

global class BatchOpportunitySnapshotReportCreation implements Database.Batchable<SObject>,Database.Stateful
{
     global final Set<Id> ownerList = new Set<Id>();
     global string exceptn= '';
     global string query; 
     global boolean isTestRunning;
      List<User> FYoppOwners = new List<User>();
     global BatchOpportunitySnapshotReportCreation()
     {
         System.debug('Constructor calling@@@@@@');
         FYoppOwners = [SELECT Id,Name,Team__c,Area__c,CurrencyIsoCode FROM User WHERE Id IN (SELECT OwnerId FROM Opportunity WHERE CloseDate = THIS_FISCAL_YEAR)];
         System.debug('Constructor calling@@@@@@'+FYoppOwners);
         if(FYoppOwners.size()>0)
         {
             for(user uid : FYoppOwners)
             {
                 ownerList.add(uid.Id);
             }
         }
     }   
     global database.QueryLocator start(Database.BatchableContext BC)
    {
        System.debug('Opportunity Owner list&&&&&&'+ownerList);
       
        List<Opportunity> oppReport = new List<Opportunity>();
         if(isTestRunning==null)
         {
            isTestRunning = false;
         }  
         
         query = 'SELECT Id,Total_First_Year_Revenue__c ,X1st_Year_Expected_Revenue__c,Probability,ExpectedRevenue,Amount,OwnerId,Owner.CurrencyIsoCode,Days_took_to_Close__c,Owner.Name,Owner.Team__c,Owner.Area__c,StageName' +
                        ' FROM Opportunity' +
                          ' WHERE OwnerId IN : ownerList' +
                          ' AND CloseDate = THIS_FISCAL_YEAR'+
                        ' ORDER BY Owner.Name,Owner.Team__c,Owner.Area__c,StageName';
         System.debug(LoggingLevel.DEBUG, query);
         return Database.getQueryLocator(query);
        
    }
    global void execute(Database.BatchableContext BC, List<Opportunity> opptysToReport)
    {
        try
        {
            
            System.debug('execute function@@@@@@@@'+opptysToReport);
            if(opptysToReport.size()>0)
            {
                    OpportunitySnapshotHelper.executeSnapshotCreation(opptysToReport,FYoppOwners);
            }
        }
        catch(Exception e)
        {
             exceptn += e.getMessage();  
            System.debug('@@@@@@Exception'+exceptn);
        }
        
    }
    global void finish(Database.BatchableContext BC)
    {
       
        
         System.debug(LoggingLevel.WARN,'Opportunity Snapshot is Complete!');
     }
}


Please help me with the test class
   



 
Hello, 

I need to create a lightining component with a button that calls a standard action to create a case. Is there possible?
Hello,
I need to export the State & Country picklist values which I think are in the Settings folder in the workbench but I need an xml file to do so

Looking for the format of the xml file needed
Hi Every one,
I have one custom object in that am creating price field with currency data type and I enabled the multi-currency(Picklist).
whenever I selected USproof for above discussion dollar in the picklist and I trying to insert value with a dollar sign($) in price field it will throw an error like invalid currency field, and I want to replace this message with my own error message can u help me is it possible or not.

 

Hello!

We have made the jump to lightning. Our Javascript buttons are now unavailable and the button conversion app says we must manually convert them (I have no idea where to begin with this).

Attached is the button code that we would like to convert to work in lightning.

Essentially the button switched record type from one to another without hitting the edit screen.

I look forward to your expert responses.

Kind regards,

Hi,

I deployed my changes from dev sandbox to UAt sandbox. When I ran the test classes in dev it works fine and no issues with code covera ge as well. But after deploying these changes to UAT test classes are failing and code coverage shows 0%.

Please help me out on this. 

Thanks and Regards,
Kishore
I have a test class which is as below
@isTest
private class KC_Reg_Handler_Test {
    static testMethod void testCreateAndUpdateUser() {

        KC_RegHandler handler = new KC_RegHandler ();
        Auth.UserData sampleData = new Auth.UserData('testId', 'testFirst', 'testLast',
                                                     'testFirst testLast', 'testuse8888r@example.org', null, 'testuserlong', 'en_US', 'facebook',
                                                     null, new Map<String, String>{'language' => 'en_US'});

        try{
           user  u = handler.createUser(null, sampleData);

            // insert(u);
            //String uid = u.id;

            sampleData = new Auth.UserData('testNewId', 'testNewFirst', 'testNewLast',
                                           'testNewFirst testNewLast', 'testnewuser@example.org', null, 'testnewuserlong', 'en_US', 'facebook',
                                           null, new Map<String, String>{});
            handler.updateUser(null, null, sampleData);
        }catch(Exception e){

        }
        // User updatedUser = [SELECT userName, email, firstName, lastName, alias FROM user WHERE id=:uid];

    }

     @isTest (seeAllData=true)
static void testPDRegistrationLocaleLangCheckChineseTrad() {
    Account acct = testDataGenerator.createTestAccount();                 
    Contact cont = testDataGenerator.createTestContact();

    String uniqueName = 'xyz@newtest.666555444.com';
    Auth.UserData dataX= new Auth.UserData('goodidentifier', 'firstName', 'lastName', 'fullName', 'cat@newtest.com', 
        null, uniqueName, 'en', 'provider', null, null);        

    Test.startTest();
    // PD Auth Provider Testing
    kc_RegHandler authP = new kc_RegHandler();    

    acct.GoogleId__c = 'goodidentifier';      
    String AccReq = '{"timezone":null,"strId":"","locale":"es_EC","lastName":"","language":"zh_HK","googleId":"0","gmailAddress":"0@newtest.com","firstName":"","emailAddress":"0@newtest.com","customId":"0","alias":null}';
    acct.Account_Request__c = AccReq;
    acct.Account_Status__c = 'Active';
    update acct;
    User temp = authP.createUser(UserInfo.getUserId(), dataX);        
    User goodLocaleLang = [SELECT Id, languagelocalekey, localesidkey, Contact.Account.Account_Request__c FROM User WHERE Id=:temp.Id LIMIT 1];        
    System.assertEquals(goodLocaleLang.Contact.Account.Account_Request__c, AccReq);
    System.assertEquals(goodLocaleLang.languagelocalekey, 'zh_CN');
    System.assertEquals(goodLocaleLang.localesidkey, 'es_EC');

    Test.stopTest();
}
}

Code from Reg Handler Apex class:
global boolean canCreateUser(Auth.UserData data) {
        //TODO: Check whether we want to allow creation of a user with this data
        /*Set<String> s = new Set<String>{'brian@foreverliving.com.dev'};
        if(s.contains(data.username)) {
            return true;
        }
        return false;*/
        return true;
    }

    global User createUser(Id portalId, Auth.UserData data){
        if(!canCreateUser(data)) {
            //Returning null or throwing an exception fails the SSO flow
            return null;
        }
}


in the above code, I found that the user is not getting inserted and after running the test class, I am recieving null pointer exception. That means the user is not getting created/inserted at authP.CreateUser and auth.CanCreateUser These methods are creating users and when I have checked this null pointer, my code is not getting covered completely.
I have removed these methods but found that my code is covered to only 12%
Can anyone please help me out with this.

UseCase. Whenever an opportunity is Closed Won In Salesforce, a notification should be sent to a slack channel.
Steps i already completed:
Created apex class and test class 
Created a process builder to run that apex class with the reuired consition.
Error i am getting:
Developer script exception from Numerator : SlackOpportunityPublisher for job ID 7071V00003XTnvR. : Unauthorized endpoint, please check Setup->Security->Remote site settings. endpoint = https://xyz.slack.com/services/T0298VAEK/BLPETK2R2/Rac52NjPIQSkanrlNAV8r5BL

Not able to add this full endpoint. Can someone please help.
Thanks.
Hi,

I am having a apex class which i am trying to post the opp id and account id from opportunity along with the text on opportunity object alone , this fires on posting a content i n chatter


i have written the apex class , but for some reasong its not firing

help me if i am doing anything wrong here
public class EditFeedItemHelper {

  /**

  * Call this method from an after insert FeedItem trigger.

  * It updates the feed items passed in and preserves @mentions.

*/

  public static void edit(FeedItem[] feedItems) {

    String communityId = Network.getNetworkId();

    List<String> feedItemIds = new List<String>();

    for (FeedItem f : feedItems) {

        feedItemIds.add(f.id);

    }

        // Get all feed items passed into the trigger (Step #1).

    ConnectApi.BatchResult[] results = ConnectApi.ChatterFeeds.getFeedElementBatch(communityId, feedItemIds);

    for (ConnectApi.BatchResult result : results) {

        if (result.isSuccess()) {

            Object theResult = result.getResult();

            if (theResult instanceof ConnectApi.FeedItem) {

                ConnectApi.FeedItem item = (ConnectApi.FeedItem) theResult;

                // Convert message segments into input segments (Step #2a).

                ConnectApi.FeedItemInput input = ConnectApiHelper.createFeedItemInputFromBody(item.body);

                // Modify the input segments as you see fit (Step #2b).

                modifyInput(input);

                // Update the feed item (Step #2c).

                // We need to update one feed item at a time because there isn't a batch update method yet.

                ConnectApi.ChatterFeeds.updateFeedElement(communityId, item.id, input);

            }

            else {

                // Do nothing. Posting other feed element types isn't supported.

            }

        }

        else {

                System.debug('Failure in batch feed element retrieval: ' + result.getErrorMessage());

        }

    }

}

    /**

    * Update the feed item input here!

    */

    public static void modifyInput(ConnectApi.FeedItemInput input) {

          set<id> parentAccountIds = new set<id>();
          List<FeedItem> fd = new List<FeedItem>();
              for(FeedItem fdItem : fd){
          String idStr = fdItem.Parentid;
            if(idStr.startsWith('006')){
           parentAccountIds.add(idStr);
        }
                      }
        
           Map<id,Opportunity> oppty  = new Map<id,Opportunity>([Select id, AccountId  from Opportunity where id in:parentAccountIds]);
             if(oppty.size()>0){
             for(FeedItem fdItem : fd){
          Opportunity parentopportunity = oppty.get(fdItem.Parentid);
                  String chatterBody = fdItem.Body;
           fdItem.Body = chatterBody + '\n Account Id is :'+ parentopportunity.AccountId + ' \n Opportunity Id :'+parentopportunity.Id;

          
      FeedItem feedpost = new FeedItem();
        feedpost.ParentId = 'a0hD000000E3jeI';  //ObjectID
        feedpost.Body = chatterBody + '\n Account Id is :'+ parentopportunity.AccountId + ' \n Opportunity Id :'+parentopportunity.Id;
       // feedpost.Type = chatterBody + '\n Account Id is :'+ parentopportunity.AccountId + ' \n Opportunity Id :'+parentopportunity.Id;
        //feedpost.LinkUrl = 'http://maps.google.com' ;
        
        insert feedpost;
            
             
              



        // This example appends text to the feed item.

        ConnectApi.TextSegmentInput textInput = new ConnectApi.TextSegmentInput();
        textInput.text =  feedpost.Body;
        input.body.messageSegments.add(textInput);

    }
      }
              
     }

}

Kindly help me pls

Thanks n Advance
Little confused about the scope of a static variable here. I have 2 scenarios:
  • Two recursive trigger methods A and B in the same transaction - Does it mean will I need two static variables a and b to apply the recursion control for each one? And if this is true, does this mean I will need , e.g. 6 static variables doing the same thing to control 6 recursive methods in a single transaction? 😮
  • How does this scenario differ when I rather have 2 users instantiating the same transaction at the same time?
I went through the SF documentation and I couldn't get a clear idea on this. Any help on this would be greatly appreciated.