• sai sekhar 1
  • NEWBIE
  • 35 Points
  • Member since 2015

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

I am using skill based routing on a custom object and it is working fine.But is there anyway to control Agent work status because the agentwork will be closed just after closing the tab in the console. I would like to control it based on my Custom object record status. Is there any work around for this.

Regards,
Sai.
Hi,
I have created a bucket field for Top Case Drivers by SolarBot Ownership challenge. But my report seems wrong. Please check the screenshots.
User-added image
User-added image
Regards,
Sai.
Hi All,

I am facing the below error.
ErrorReportUser-added imageUser-added image

User-added image
Regards,
T.Saisekhar.
Hi,

I am getting the following error eventhough I defined selected attribute .

User-added image

please check my code

boatserachresults:
<aura:component controller="BoatSearchResults">
    
    <aura:handler name="init" action="{!c.doSearch}" value="{!this}"/>
    <aura:attribute name="boats" type="Boat__c[]" />
    <aura:attribute name="boatTypeId" type="id" />
    <aura:attribute name="selectedBoatId" type="id" />

    <aura:method name="search" description="accepts boatTypeId
            and executes search that refreshes the boats attribute" action="{!c.search}" >
        <aura:attribute name="boatTypeId" type="Id"/>
    </aura:method>
    
    <aura:handler name="BoatSelect"
                  event="c:BoatSelect"
                  action="{!c.onBoatSelect}"
                  phase="capture"/>
    
     <aura:if isTrue="{!not(empty(v.boats))}">
        <lightning:layout multipleRows="true" horizontalAlign="center">
                <aura:iteration items="{!v.boats}" var="boatVar">
                    <lightning:layoutItem flexibility="grow"  class="slds-m-right_small" >   
                    <c:BoatTile boat="{!boatVar}" 
                                selected="{!v.selectedBoatId==boatVar.Id ? true : false }"/>
                    </lightning:layoutItem>
                </aura:iteration>
        </lightning:layout>
         <aura:set attribute="else">
            <div class="slds-align_absolute-center">No boats found</div>
        </aura:set>
    </aura:if>
</aura:component>

Boattilecmp:
 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" >
	<aura:attribute name="boat" type="Boat__c" />
    <aura:attribute name="selected" type="boolean" default="false"/>

    <aura:registerEvent name="BoatSelect" type="c:BoatSelect"/>
    
    <lightning:button name="{!v.boat.Id}" class="{!v.selected? 'tile selected' : 'tile'}"
                       onclick="{!c.onBoatClick}" >
        <div style="{! 'background-image:url(\'' + v.boat.Picture__c + '\'); '}" class="innertile">
          <div class="lower-third">
           <h1 class="slds-truncate">{!v.boat.Contact__r.Name}</h1>
          </div>
        </div>
    </lightning:button>
</aura:component>

 
Hi,

Why my component aligned to left.Please check my code.

Searchform:
<article class="slds-card slds-m-bottom_large">
        <div class="slds-media__body">
            <div >

                <lightning:layout horizontalAlign="center" verticalAlign="end">
                    <lightning:layoutItem padding="horizontal-medium" >
                        <!-- Create a dropdown menu with options -->
                        <lightning:select aura:id="boatTypes" label="" name="selectType"
                                          onchange="{!c.handleChange}">
                            <option value="">All Types</option>
                            <aura:iteration items="{!v.BoatTypes}" var="boatType">
                                <option value="{!boatType.Id}" text="{!boatType.Name}"/>
                            </aura:iteration>
                        </lightning:select>

                    </lightning:layoutItem>


                    <lightning:layoutItem>
                        <div class="slds-button-group" role="group">
                            <lightning:button class="slds-button" variant="brand" label="Search" onclick="{!c.search}"/>

           
                            <aura:if isTrue="{!v.renderNew}">
                                <lightning:button class="slds-button" variant="neutral" label="New" onclick="{!c.newBoat}"/>
                            </aura:if>
                        </div>
                    </lightning:layoutItem>
                </lightning:layout>
            </div>
        </div>
    </article>

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction"  access="global" >
<lightning:layout >
                 
                 <lightning:card title="Find a Boat" class="slds-m-top--medium" >
                          <c:BoatSearchForm />
                         
                 </lightning:card>
   </lightning:layout>
               <lightning:layout >
                <lightning:card title="Matching Boats" class="slds-m-top--medium">
                         <c:BoatSearchResults/>
                         
                 </lightning:card>
                    

    </lightning:layout>    
</aura:component>

User-added image
Hi ,

The below test class and it is  throwing an error :System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out

@isTest
private class ProjectCalloutServiceTest {
    //Implement mock callout tests here

    @testSetup static void testSetupdata(){
        //create the opportunity record
        Opportunity opp1 = new Opportunity();
        opp1.Name = 'sai Corp1';
        opp1.Type = 'New Project';
        opp1.Amount = 200;
        opp1.CloseDate = Date.today();
        opp1.StageName = 'Submitted Project';
        insert opp1;
        //create the opportunity record
        Opportunity opp2 = new Opportunity();
        opp2.Name = 'sai Corp2';
        opp2.Type = 'New Project';
        opp2.Amount = 150;
        opp2.CloseDate = Date.today();
        opp2.StageName = 'Resubmit Project';
        insert opp2;
        //create the Custom Settings
        ServiceTokens__c servToken = new ServiceTokens__c();
        servToken.Name = 'ProjectServiceToken';
        servToken.Token__c = '67bac2a8-61b5-4f5b-9dda-51de3b18369a';
        insert servToken;
    }
    
    @isTest static void testPostCalloutSuccess() {
        Opportunity opp = [Select Id, Name FROM Opportunity WHERE Name = 'sai Corp1' Limit 1];
        List<Id> oppList = new List<Id>();
        oppList.add(opp.Id);
        System.assertEquals('sai Corp1', opp.Name);
        System.assertEquals(1,oppList.size());
        Test.startTest();
        // Set mock callout class 
        Test.setMock(HttpCalloutMock.class, new ProjectCalloutServiceMock()); 
        // This causes a fake response to be sent
        // from the class that implements HttpCalloutMock. 
        ProjectCalloutService.postOpportunityToPMS(oppList);
        // Verify that the response received contains fake values
        Test.stopTest();    
        opp = [select StageName from Opportunity where id =: opp.Id];
        System.assertEquals('Submitted Project',opp.StageName);
    }
    
    @isTest static void testPostCalloutFailure() {
        Opportunity opp = [Select Id, Name FROM Opportunity WHERE Name = 'sai Corp2' Limit 1];
        List<Id> oppList = new List<Id>();
        oppList.add(opp.Id);
        System.assertEquals('sai Corp2', opp.Name);
        System.assertEquals(1,oppList.size());
        Test.startTest();
        // Set mock callout class 
        Test.setMock(HttpCalloutMock.class, new ProjectCalloutServiceMockFailure()); 
        // This causes a fake response to be sent
        // from the class that implements HttpCalloutMock. 
        ProjectCalloutService.postOpportunityToPMS(oppList);
        // Verify that the response received contains fake values
        Test.stopTest();        
        opp = [select StageName from Opportunity where id =: opp.Id];
        System.assertEquals('Resubmit Project',opp.StageName);
    }
    
}

public class ProjectCalloutService {
    
    //method to be invoked by ProcessBuilder apex
    @InvocableMethod
    public static void postOpportunityToPMS(List<Id> oppoIds){
        Opportunity opportunity = [SELECT Id,Name,Account.Name,CloseDate,Amount FROM Opportunity WHERE Id = :oppoIds[0]];
        String serviceToken = ServiceTokens__c.getValues('ProjectServiceToken').Token__c;
        String jsonInput = '{\n' +
            ' "opportunityId" : "'+opportunity.Id+'",\n'+
            ' "opportunityName" : "'+opportunity.Name+'",\n'+
            ' "accountName" : "'+opportunity.Account.Name+'",\n'+
            ' "closeDate" : "'+String.ValueOf(opportunity.CloseDate).mid(0,10)+'",\n'+   
            ' "amount" : "'+opportunity.Amount+'"\n}';
        System.enqueueJob(new QueueablePMSCall(serviceToken, jsonInput, opportunity.Id));
    }
    
    // future method to make apex callout
    @Future(callout=true)
    private static void postToPMS(String serviceToken, String jsonInput, Id oppoId) {
            HTTPRequest req = new HTTPRequest();
            req.setEndPoint('callout:ProjectService');
            req.setMethod('POST');
            req.setHeader('token',serviceToken);
            req.setHeader('Content-Type', 'application/json;charset=UTF-8');        
            req.setBody(jsonInput);
            HTTP http = new HTTP();
            HTTPResponse res = http.send(req);
            Opportunity opp = new Opportunity(Id=oppoId);
            if(res.getStatusCode() != 201){
                opp.StageName = 'Resubmit Project';
                System.debug('Failure: ' + res.getStatusCode() + ' ' + res.getStatus());
            } else {
                opp.StageName = 'Submitted Project';                
                System.debug('Success: ' + res.getStatus());
            }
            update opp;
    }
    
    //queueable class to enque the post request
    class QueueablePMSCall implements System.Queueable, Database.AllowsCallouts {
        private String serviceToken;
        private String jsonInput;
        private String Id;
        public QueueablePMSCall(String serviceToken, String jsonInput, Id oppoId){
            this.serviceToken = serviceToken;
            this.jsonInput = jsonInput;
            this.Id = oppoId;
        }
        public void execute(QueueableContext context) {
            postToPMS(serviceToken, jsonInput, Id);
        }
    }
    
}
Hi All,

I have displayed chart in lightning component using <canvas>
Now i want to send that chart as an attachment in email when click on ''send Email" button.Can you Please anyone help me with how to send as an excel format in the lightning component.

Thanks 
Hi All,

I am facing the below error.
ErrorReportUser-added imageUser-added image

User-added image
Regards,
T.Saisekhar.
Hello Trailblazers!

I'm stuck on last challenge for LEX Specialist Superbadge, and I've been trying all corrections proposed on the feeds I've found, but none of it is working, so I'm starting a new post to try to see it clearer (and maybe discuss only on last version of the SB, which seems to have evolved a lot on past 2 years)...
Existing posts I've gone through:
https://developer.salesforce.com/forums/?id=906F0000000kFtrIAE
https://developer.salesforce.com/forums/?id=906F0000000kKecIAE
https://developer.salesforce.com/forums/?id=906F0000000BXDeIAO#!/feedtype=SINGLE_QUESTION_SEARCH_RESULT&id=906F0000000kEDkIAM (it has some discussion over challenge #9 in the middle)

Maybe my problem has to do with the SB being started 2 years ago on my side, on a Trailhead Playground which I cannot access anymore. I've started over on a brand new TP, but I might have stumble on a previous steps that I didn't need to re-validate?

As many people, I'm getting the following error when trying to complete the challenge:
"Challenge Not yet complete... here's what's wrong:
The 'Opp Stage by Adventure' report does not appear to be configured correctly. Make sure it has the correct report type, groupings, filters and chart type."

So, what I'm doing:
  • Create a Report from standard "Opportunities with Adventures" Report Type
  • Name it "Opp Stage by Adventure"
  • Filter on "Product Date" from 1/12026 to 12/1/2026 (and getting results)
  • Remove filter on "stage"
  • Add a vertical-stacked bar graph named "Adventure Stage Comparison"
  • On "Adventure record Lightning page", create a tab called "Adventure comparison" and inserted my newly created graph, with label "Adventure Stage Comparison"

What I have tried already :
  • Log out/log in of sandbox & Trailhead. Also after waiting for a day.
  • Change grouping order in graph: Adventure first & Stage second // Stage first & Adventure second
  • Change y-axis from "record count" to "sum of amount"
  • Use "Product Name" standard field or created "Adventure name" which I populated with same values than Product Name
  • Change folder in which the report is in: from "Unfiled Public Report" to a created folder which I shared with all users.
  • Create the report in LEX (Lightning report or Classic report in LEX) or in Classic interface
  • Create a custom Report Type "Opportunities with Adventures", but I cannot find the fields "Adventure Name" & "Product Date" to add them
  • Check there are no other Reports with a similar name "Opp Stage by Adventure"
  • Change the My Domain setting for background color
  • Check for "paused flows" (even if I do not see the link, it was hinted as a potential problem in a thread)

Some questions I still ask myself:
  • I renamed Product object to Adventure, but I cannot rename standard fields such as Product Name or Product Date. And I see "Adventure Name" being used on screenshots in threads.
  • Shouldn't I receive an email when successfully changing My Domain settings?
  • Am I just plain crazy and missing something obvious?
  • Should I start over the whole superbadge on a brand new Trailhead Playground, and is there a way to "uncheck" previous challenges?
Any help or insight is welcome, thanks in advance!

Quentin
Hi ,

The below test class and it is  throwing an error :System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out

@isTest
private class ProjectCalloutServiceTest {
    //Implement mock callout tests here

    @testSetup static void testSetupdata(){
        //create the opportunity record
        Opportunity opp1 = new Opportunity();
        opp1.Name = 'sai Corp1';
        opp1.Type = 'New Project';
        opp1.Amount = 200;
        opp1.CloseDate = Date.today();
        opp1.StageName = 'Submitted Project';
        insert opp1;
        //create the opportunity record
        Opportunity opp2 = new Opportunity();
        opp2.Name = 'sai Corp2';
        opp2.Type = 'New Project';
        opp2.Amount = 150;
        opp2.CloseDate = Date.today();
        opp2.StageName = 'Resubmit Project';
        insert opp2;
        //create the Custom Settings
        ServiceTokens__c servToken = new ServiceTokens__c();
        servToken.Name = 'ProjectServiceToken';
        servToken.Token__c = '67bac2a8-61b5-4f5b-9dda-51de3b18369a';
        insert servToken;
    }
    
    @isTest static void testPostCalloutSuccess() {
        Opportunity opp = [Select Id, Name FROM Opportunity WHERE Name = 'sai Corp1' Limit 1];
        List<Id> oppList = new List<Id>();
        oppList.add(opp.Id);
        System.assertEquals('sai Corp1', opp.Name);
        System.assertEquals(1,oppList.size());
        Test.startTest();
        // Set mock callout class 
        Test.setMock(HttpCalloutMock.class, new ProjectCalloutServiceMock()); 
        // This causes a fake response to be sent
        // from the class that implements HttpCalloutMock. 
        ProjectCalloutService.postOpportunityToPMS(oppList);
        // Verify that the response received contains fake values
        Test.stopTest();    
        opp = [select StageName from Opportunity where id =: opp.Id];
        System.assertEquals('Submitted Project',opp.StageName);
    }
    
    @isTest static void testPostCalloutFailure() {
        Opportunity opp = [Select Id, Name FROM Opportunity WHERE Name = 'sai Corp2' Limit 1];
        List<Id> oppList = new List<Id>();
        oppList.add(opp.Id);
        System.assertEquals('sai Corp2', opp.Name);
        System.assertEquals(1,oppList.size());
        Test.startTest();
        // Set mock callout class 
        Test.setMock(HttpCalloutMock.class, new ProjectCalloutServiceMockFailure()); 
        // This causes a fake response to be sent
        // from the class that implements HttpCalloutMock. 
        ProjectCalloutService.postOpportunityToPMS(oppList);
        // Verify that the response received contains fake values
        Test.stopTest();        
        opp = [select StageName from Opportunity where id =: opp.Id];
        System.assertEquals('Resubmit Project',opp.StageName);
    }
    
}

public class ProjectCalloutService {
    
    //method to be invoked by ProcessBuilder apex
    @InvocableMethod
    public static void postOpportunityToPMS(List<Id> oppoIds){
        Opportunity opportunity = [SELECT Id,Name,Account.Name,CloseDate,Amount FROM Opportunity WHERE Id = :oppoIds[0]];
        String serviceToken = ServiceTokens__c.getValues('ProjectServiceToken').Token__c;
        String jsonInput = '{\n' +
            ' "opportunityId" : "'+opportunity.Id+'",\n'+
            ' "opportunityName" : "'+opportunity.Name+'",\n'+
            ' "accountName" : "'+opportunity.Account.Name+'",\n'+
            ' "closeDate" : "'+String.ValueOf(opportunity.CloseDate).mid(0,10)+'",\n'+   
            ' "amount" : "'+opportunity.Amount+'"\n}';
        System.enqueueJob(new QueueablePMSCall(serviceToken, jsonInput, opportunity.Id));
    }
    
    // future method to make apex callout
    @Future(callout=true)
    private static void postToPMS(String serviceToken, String jsonInput, Id oppoId) {
            HTTPRequest req = new HTTPRequest();
            req.setEndPoint('callout:ProjectService');
            req.setMethod('POST');
            req.setHeader('token',serviceToken);
            req.setHeader('Content-Type', 'application/json;charset=UTF-8');        
            req.setBody(jsonInput);
            HTTP http = new HTTP();
            HTTPResponse res = http.send(req);
            Opportunity opp = new Opportunity(Id=oppoId);
            if(res.getStatusCode() != 201){
                opp.StageName = 'Resubmit Project';
                System.debug('Failure: ' + res.getStatusCode() + ' ' + res.getStatus());
            } else {
                opp.StageName = 'Submitted Project';                
                System.debug('Success: ' + res.getStatus());
            }
            update opp;
    }
    
    //queueable class to enque the post request
    class QueueablePMSCall implements System.Queueable, Database.AllowsCallouts {
        private String serviceToken;
        private String jsonInput;
        private String Id;
        public QueueablePMSCall(String serviceToken, String jsonInput, Id oppoId){
            this.serviceToken = serviceToken;
            this.jsonInput = jsonInput;
            this.Id = oppoId;
        }
        public void execute(QueueableContext context) {
            postToPMS(serviceToken, jsonInput, Id);
        }
    }
    
}
Hi,

I'm currently working on the Lightning Component Framework Specialist Superbadge.

When I click "New", at least as I've interpretted the requirements, the "Friends with Boats" pages is behaving as expected, but Trailhead complains:
Challenge Not yet complete... here's what's wrong: 
The BoatSearchForm component's "New" button should launch the default boat record create page using logic in its controller.

Have I misunderstood a requirement?

Here is my markup:
 
<aura:component controller="BoatSearchFormAuraCtrl" >
	<aura:attribute access="private" name="boatList" type="BoatType__c[]" default="[]" />
	<aura:attribute access="private" name="showNewButton" type="Boolean" default="false" />
	<aura:attribute access="private" name="selectedBoat" type="BoatType__c" />
	
	<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
	
	<h2 class="slds-page-header__title">Find a Boat</h2>
	<form>
		<lightning:layout horizontalAlign="center">
		    <lightning:select name="select" value="{!v.selectedBoat}">
		        <option value="">All Types</option>
		        <aura:iteration items="{!v.boatList}" var="boat">
		            <option value="{!boat.Name}" text="{!boat.Name}"></option>
		        </aura:iteration> 
		    </lightning:select>
		    <lightning:button name="Search" label="Search" variant="brand" />
		    <aura:if isTrue="{!v.showNewButton}">
		    	<lightning:button name="New" label="New" variant="neutral" onclick="{!c.createBoat}"/>
		    </aura:if>
		</lightning:layout>
	</form>	
</aura:component>
And here is my controller:
({
	doInit : function(component, event, helper) {
		component.set('v.showNewButton', $A.get('e.force:createRecord'));
		helper.setBoatTypeList(component);
	},
	
	createBoat : function(component) {
		var createRecordEvent = $A.get('e.force:createRecord');
		createRecordEvent.setParams({
			'entityApiName' : 'BoatType__c',
			'defaultFieldValues': {
				'Name': component.get('v.selectedBoat')
			},
		});
		createRecordEvent.fire();
	}
})





 
Hello,

I am preparing to move a webservice call that has been in testing in my sandbox environment and works as expected there.  When I run the same call against my production environment I receive the following error:

Fatal error: Uncaught SoapFault exception: [sf:INVALID_SESSION_ID] INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session hash: <**HASH REMOVED**> This is expected, it can happen if the session has expired and swept away, or if the user logs out, or if its just someone trying to hack in.

The code is fairly simple - I am creating a connection with the PHP toolkit using the appropriately generated partner wsdl.jsp and logging in.  I am able to log in  but when I make the call to the webservice I am given the error above.  Could this be an issue in the way the production org is set up or do I need to look elsewhere?

Code used to call the service is below.  The error is thrown on $client->IsThisLiveProduct($valuearray);
$USERNAME = "USERNAME";
$PASSWORD = "PASSWORD";
$TOKEN = "TOKEN";

require_once ('/soapclient/SforcePartnerClient.php');
require_once ('/soapclient/SforceHeaderOptions.php');

$mySforceConnection = new SforcePartnerClient();
$mySoapClient = $mySforceConnection->createConnection("../forcecom2/soapclient/wsdl.jsp.xml");
$mylogin = $mySforceConnection->login($USERNAME, $PASSWORD . $TOKEN);

$parsedURL = parse_url($mySforceConnection->getLocation());
define ("_WS_NAME_", 'WSNAME');
define ("_WS_WSDL_", _WS_NAME_ . '.xml');
define ("_WS_NAMESPACE_", 'http://soap.sforce.com/schemas/class/' . _WS_NAME_);

// SOAP Client for Web Service
$client = new SoapClient(_WS_WSDL_);
$sforce_header = new SoapHeader(_WS_NAMESPACE_, "SessionHeader", array("sessionId" => $mySforceConnection->getSessionId()));
$client->__setSoapHeaders(array($sforce_header));

// Call the web service
$valuearray = array('SerialNumber'=>'SERIALNO');
$response = $client->IsThisLiveProduct($valuearray);

Thanks!
In Lightning Component Framework Specialist SuperBadge - Challenge 8, I got following error:
The BoatReview component doesn't include a public attribute named boat of type BoatType__c.