• Karthik K
  • NEWBIE
  • 39 Points
  • Member since 2014


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 24
    Replies
Hello,

I am trying to pass in an order by parameter into my soql query with example below.  I want to be able to order based on the field name that i pass into the parameter.  This is not working though.  Any help would be great. Thanks

 @AuraEnabled
    public static List<Account> getAccounts(string orderby, Integer limits, Integer offsets) {
        
        Integer intlimits = integer.valueOf(limits);
        Integer intoffsets = integer.valueOf(offsets);
        
        
        
        List<Account> accounts = 
            [SELECT Id, Name, Description, CARES_ActiveText__c FROM Account WHERE Type = 'Agency' Order By :orderby LIMIT :intlimits OFFSET :intoffsets];
        //Add isAccessible() check
        return accounts; 
    }
Getting the below error message on the "Advanced Apex Specialist" on the last step. Had made sure all test classes are covered and OrderExtension works as expected and there are more than 12 products created. I tried to delete the existing data on the system and recreated it, Very likely that causes the below error message. Have anyone got the similar error message? Would appreciate any suggestions to solve it.

Challenge Not yet complete... here's what's wrong: 
Ensure that you have at least 12 products created and that OrderExtension is still working as specified in the earlier challenge.
 
Getting the below error while trying to create "External Lookup Relationship" or "Indirect Lookup Relationship". I was able to create the fields successfully on developer org, but getting the errors while verifying the step as mentioned in the challenge.  Have followed the steps as mentioned in the article. Am i missing something here or would that be an internal error with Trail Head engine. Please advise

Error Message :
There was an unhandled exception. Please reference ID: LEKBWJVE. Error: Faraday::ResourceNotFound. Message: NOT_FOUND: The requested resource does not exist
Note: you may run into errors if you've skipped previous steps.

Module URL :
https://developer.salesforce.com/trailhead/project/quickstart-lightning-connect/quickstart-lightning-connect3
Hi All, 

I have the following error showing in the apex jobs that I was runnig in to the batch process. But the status shows as completed. I need to know what might be the issues was. I do not use any substring in this batch class and I have only the list collection and updating the lists.
 

2/28/2018 1:00 AM
Batch ApexCompletedFirst error: Ending position out of bounds: -11,5111,5110Persson, Philip2/28/2018 2:21 AMAccountUpdateWithStuCollecBatch_AC
 
Any help would be greatly appreciated!
 
Hi All, 

I would like to know if there is a possibility to deploy the process builder with active status in any way of deployment?. Currently I am facing the issue like is it was deployed through Ant migration tool with inactive status. So, I have to manually activate it after deployment.

Thanks in Advance!
select Id,status,Priority,opportunity__r.Name,opportunity__c  from case where id=:Opportunity__c
select Id,status,Priority,opportunity__r.Name,opportunity__c  from case where id=:Opportunity__c

 
I am working on a validation on a number field that is apart of a managed package so we cannot change the number of decimals.  I need to the field to always have a whole number entered.  The validation I have below, works for the most part, except when 10,20,30 are entered. The Validation work corrects when 15,25, etc are entered.  Any help? 

AND( 
NOT(REGEX(TEXT( jstcl__Burden__c ), "[0-9]+[.]{1}[0-9]{2}")), 
NOT( jstcl__Burden__c =0))
Hello All,

Please help me to create a record on Custom Object using javascript button.

1. Whenever i click a button it should pick (accountid,ownerid,CloseDate) from Opportunity record
2. It should create a record with above fields on Custom Object.
===================================================
> The below code that i have written is throwing an error on chrome browser
(faultstring:'soapenv:Client',faultstring:''NaN-NaN-NaNTNaN:NaN:NaN:NaN-NaN:NaN' is not a valid value for the type xsd:date',)
> When i try this in IE it is giving me some other date in internet explorer
> I have tried so many things (parsing,format,toISOString,toLocaleDate..etc..,) but no luck.
===================================================
Code:
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")}

var opp = new sforce.SObject("Opportunity");
opp.Account = "{!Opportunity.AccountId}";
opp.OwnerId = "{!Opportunity.OwnerId}";
opp.CloseDate = "{!Opportunity.CloseDate}";
alert(opp.CloseDate);

var ord = new sforce.SObject("Order__c");
ord.Account_Name__c = opp.Account;
ord.Account_Director_Name__c = opp.OwnerId;
if(opp.CloseDate==null || opp.CloseDate == ''){
   ord.Customer_Signature_date__c = null;
} else {
   var temp = new Date(opp.CloseDate);
   ord.Customer_Signature_date__c = temp;
}

new_rec = sforce.connection.create([ord]);
 alert('Opportunity Converted successfully ID : '+new_rec[0].id);
======================================================

Please correct me what is the wrong with my code. Every field is populating except closeDate field.

Thanks in Advance,
Teja
Hello,

I'm trying to create an apex class to use in testing an attachment trigger I created below - 

 
//Trigger to update the Send_Attachment_Email__c custom checkbox field on Opportunity if it has an attachment.

trigger attachmentTrigger on Attachment (after insert) {

list<Opportunity> o = [select id,   Send_Attachment_Email__c, StageName from Opportunity where id =: Trigger.New[0].ParentId] ;
    if(o.size()>0 ) {
        o[0].Send_Attachment_Email__c = true;
        update o;
    }
    }



Could you please advise me on the apex class needed to make sure this satisfies the code coverage?

I have a hierarchy lightning component and I'm using https://github.com/dabeng/OrgChart as a static resource to generate the hierarchy chart.  For the most part it works great.  However I am running into an issue with drag and drop functionality that I can't seem to figure out.  That library has a section of code to generate a drag image when the user has panned the chart due to some older browsers (and Safari) not handling the transform correctly.  The problem is that when used in a lightning component on Salesforce it throws an error.  It seems like dataTransfer.setDragImage(img, xOffset, yOffset) doesn't work.  I even tried simplifying the code in the library to one of the most basic examples in this tutorial and was still running into issues.  The error I keep seeing is "[Argument 1 ('image') to DataTransfer.setDragImage must be an instance of Element]" however if I debug and look at the element that it's trying to use everything seems fine with it.  Does anyone know if something in Locker Service is interfering with this or have any ideas what else may be going on?

Here's the function that is having issues:

createGhostNode: function (event) {
      var $nodeDiv = $(event.target);
      var opts = this.options;
      var origEvent = event.originalEvent;
      var isFirefox = /firefox/.test(window.navigator.userAgent.toLowerCase());
      if (isFirefox) {
        origEvent.dataTransfer.setData('text/html', 'hack for firefox');
      }
      var ghostNode, nodeCover;
      if (!document.querySelector('.ghost-node')) {
        ghostNode = document.createElementNS("http://www.w3.org/2000/svg", "svg");
        ghostNode.classList.add('ghost-node');
        nodeCover = document.createElementNS('http://www.w3.org/2000/svg','rect');
        ghostNode.appendChild(nodeCover);
        $nodeDiv.closest('.orgchart').append(ghostNode);
      } else {
        ghostNode = $nodeDiv.closest('.orgchart').children('.ghost-node').get(0);
        nodeCover = $(ghostNode).children().get(0);
      }
      var transValues = $nodeDiv.closest('.orgchart').css('transform').split(',');
      var scale = Math.abs(window.parseFloat((opts.direction === 't2b' || opts.direction === 'b2t') ? transValues[0].slice(transValues[0].indexOf('(') + 1) : transValues[1]));
      ghostNode.setAttribute('width', $nodeDiv.outerWidth(false));
      ghostNode.setAttribute('height', $nodeDiv.outerHeight(false));
      nodeCover.setAttribute('x',5 * scale);
      nodeCover.setAttribute('y',5 * scale);
      nodeCover.setAttribute('width', 120 * scale);
      nodeCover.setAttribute('height', 40 * scale);
      nodeCover.setAttribute('rx', 4 * scale);
      nodeCover.setAttribute('ry', 4 * scale);
      nodeCover.setAttribute('stroke-width', 1 * scale);
      var xOffset = origEvent.offsetX * scale;
      var yOffset = origEvent.offsetY * scale;
      if (opts.direction === 'l2r') {
        xOffset = origEvent.offsetY * scale;
        yOffset = origEvent.offsetX * scale;
      } else if (opts.direction === 'r2l') {
        xOffset = $nodeDiv.outerWidth(false) - origEvent.offsetY * scale;
        yOffset = origEvent.offsetX * scale;
      } else if (opts.direction === 'b2t') {
        xOffset = $nodeDiv.outerWidth(false) - origEvent.offsetX * scale;
        yOffset = $nodeDiv.outerHeight(false) - origEvent.offsetY * scale;
      }
      if (isFirefox) { // hack for old version of Firefox(< 48.0)
        nodeCover.setAttribute('fill', 'rgb(255, 255, 255)');
        nodeCover.setAttribute('stroke', 'rgb(191, 0, 0)');
        var ghostNodeWrapper = document.createElement('img');
        ghostNodeWrapper.src = 'data:image/svg+xml;utf8,' + (new XMLSerializer()).serializeToString(ghostNode);
        origEvent.dataTransfer.setDragImage(ghostNodeWrapper, xOffset, yOffset);
      } else {
        origEvent.dataTransfer.setDragImage(ghostNode, xOffset, yOffset);
      }
    }


I also tried simplifying it down to this code and it still throws the same error:

createGhostNode: function (event) {
      var $nodeDiv = $(event.target);
      var origEvent = event.originalEvent;
      var ghostNode = document.createElement('img');
      ghostNode.classList.add('ghost-node');
      ghostNode.setAttribute('width', 50);
      ghostNode.setAttribute('height', 50);
      ghostNode.setAttribute('background-color', 'red');
      $nodeDiv.closest('.orgchart').append(ghostNode);
      origEvent.dataTransfer.setDragImage(ghostNode, 0, 0);
    }
We are sending an email to customer via ''Send an Email' button under activity history from Quote object.
Question: How can we store replies from the customer in activity history?
  • February 28, 2018
  • Like
  • 0
Hello, 
I am new to salesforce development and I am trying to fetch the API call from a sandbox which I am using to create an app for a company. When I reference to the link (after the wsdl file has been genorated) I get the following page:
User-added image
When infact I am expecting to see this page here:
User-added image
Subsequently this is causing my SforceService command to fail, are there any obvious mistakes I am making and can someone point me in the right direction! This is a Partner API btw.
Kindly
~Alex 
How do I insert the host name into the url?
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" access="global">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="host" type="String" />    
    <lightning:button label="Print" onclick="{!c.printModalToggle}" />   
    {! v.host + '/apex/VISUALFORCEPAGE?Id=' + v.recordId}                                      
<iframe src="{! v.host + '/apex/VISUALFORCEPAGE?Id=' + v.recordId}" width="100%" height="300px;" frameBorder="0"/>       
</aura:component>
And the controller 
({
	doInit: function(component, event, helper) {
		component.set('v.host', window.location.hostname);
	}
})
The {! v.host + '/apex/VISUALFORCEPAGE?Id=' + v.recordId} correct value but when it is entered into the iframe src attribute nothing happens. If I manually. enter that url into the address bar the page opens. Is there something with the <iframe src attribute that would give me trouble here?
  • February 28, 2018
  • Like
  • 0
HI, 

while page is loading how to do display the pop-up alert based on days in visualforce page. very urgent, kindly do the needful

Thanks,
Chinnodu

 
Problem: The connection from Data Loader to the SalesForce URL is failing in the SSL handshake due to a fatal “Certificate Unknown” alert associated with the Data Loader not trusting the Organisation(company's) certificate. Proxy details were given in the Data loader settings and we did try OAuth and Password Authentication.

Details:
  • Version of Data Loader -  38.0.1
  • Version of Java JRE being used - 1.8.0
  • Location of Java Key Store into which the Organization(Company's) certificates were installed - Java\jre1.8.0_121\lib\security
  • We ran into similiar error, when we tried to connect to salesforce from eclipse force.com IDE, but that was resolved after the orginasation(Compnay's) certs were installed into JAVA. Eclipse version - Mars.2 Release (4.5.2)
I am trying to integrate Salesforce with some external application. Using Postman I am trying out the API to post comment to Salesforce case. Can someone guide me which API to use?
 
Hello,

I am trying to pass in an order by parameter into my soql query with example below.  I want to be able to order based on the field name that i pass into the parameter.  This is not working though.  Any help would be great. Thanks

 @AuraEnabled
    public static List<Account> getAccounts(string orderby, Integer limits, Integer offsets) {
        
        Integer intlimits = integer.valueOf(limits);
        Integer intoffsets = integer.valueOf(offsets);
        
        
        
        List<Account> accounts = 
            [SELECT Id, Name, Description, CARES_ActiveText__c FROM Account WHERE Type = 'Agency' Order By :orderby LIMIT :intlimits OFFSET :intoffsets];
        //Add isAccessible() check
        return accounts; 
    }
I have a field that has a picklist that offers the options "Y" or "N". I have a separate field that needs to be empty if the answer is Y and required if the answer is N to that previous field. 

This is the validation I have to make it required if "N": 

AND( 
ISPICKVAL(Bank_Full_Deposit_Flag_1__c , "N") 
)



The field that it is applied to is called "Bank_Deposit_Deduction_Amount_1__c"
I just can't seem to figure out the "Must be blank" part for "Y". Appologies if I'm missing something obvious here. I have been going through the guide and can't seem to find it. 
Hi Guys- I have a vf page which is refrencing vf components. I ran into an issue based where if I change the order of vf page it shows the icon else it doesn't.
code
-------
 <div id="mainDiv" class="slds-tabs_default slds-theme_default">
        <ul class="slds-tabs_default__nav" role="tablist">
            <li class="slds-tabs_default__item slds-is-active" title="Events" role="presentation"><a class="slds-tabs_default__link" href="javascript:void(0);" role="tab" tabindex="0" aria-selected="true" aria-controls="tab-default-1" id="tab-default-1__item">tab1</a></li>
            <li class="slds-tabs_default__item" title="Products" role="presentation"><a class="slds-tabs_default__link" href="javascript:void(0);" role="tab" tabindex="-1" aria-selected="false" aria-controls="tab-default-2" id="tab-default-2__item">tab2</a></li>
            <li class="slds-tabs_default__item" title="Orders" role="presentation"><a class="slds-tabs_default__link" href="javascript:void(0);" role="tab" tabindex="-1" aria-selected="false" aria-controls="tab-default-3" id="tab-default-3__item">tab3</a></li>
        </ul>
        <div id="tab-default-1" class="slds-tabs_default__content slds-show" role="tabpanel" aria-labelledby="tab-default-1__item"><c:Activity acctRecord="{!acct}"/></div>
        <div id="tab-default-3" class="slds-tabs_default__content slds-hide" role="tabpanel" aria-labelledby="tab-default-3__item"><c:act2 accountRecord="{!acct}"/></div>
        <div id="tab-default-2" class="slds-tabs_default__content slds-hide" role="tabpanel" aria-labelledby="tab-default-2__item"><c:Activity3 acctRecord="{!acct}"/></div>


------------------------------------
The lines in bold, the first one shows icons while the third one doesn't . If I change the order the third shows and second doesn't
Hi All,
I am developing one visualforce page which render as word pdf ,but the footer is displayed in between header and content.Below is the code i developed:
 <apex:page standardController="Contact" sidebar="false" showHeader="false" renderAs="PDF">
 <head>
        <style type="text/css" media="print">
            span.cls_002 {
                font-size: 12.0px;
                color: rgb(0, 0, 0);
                font-weight: bold;
                font-style: normal;
                text-decoration: none
            }
            
            div.cls_002 {
                font-size: 9.0px;
                color: rgb(0, 0, 0);
                font-weight: bold;
                font-style: normal;
                text-decoration: none
            }
            
            @page {
                <!--size: 32.7cm 25.9cm;  
                margin-top: 20%;  
                margin-bottom:9%;
                margin-right: 7%;
                margin-left: 5%;
                size: A4;-->
                size: 26.7cm 19.9cm;
               margin: 1in .5in 2in .5in;
                @top-center {
                    content: element(header);
                }
                @bottom-center {
                    content: element(footer);
                }
            }
            
            div.content {
                padding: 0 0 30px 0;
            }
            
            div.header {
                font-weight: bold;
                padding: 10px;
                position: running(header);
            }
            
             div.footer {
            display: block;
            padding: 5px;
            position: running(footer);
        }
        .pagenumber:before {
            content: counter(page);
        }
        .pagecount:before {
            content: counter(pages);
        }
        </style>
        <style>
            body {
                font-family: 'Arial Unicode MS';
            }
            
            #index {
                font-family: 'Arial Unicode MS';
            }
            
            <!--@page {
                size: landscape;
            }
            
            --> <!--@page {
                size: 32.7cm 26.5cm;
                margin-top: 0.01cm;
                margin-left: 0.5cm;
                margin-right: 1.0cm;
                margin-bottom: 0.0cm;
            }
            
            -->
        </style>
    </head>

    <apex:form>

        <body id="index">

            <div class="header">
                <div>
                
                <table width="100%">
                        <tr>
                        <!--<td>
                            <apex:image value="{!$Resource.testLogo}" height="100%" width="100%"/>
                     </td>-->
                            <td width="50%" align="left" style="margin-left: -10px;">
                                <b><span style="font-size: 14.5px;margin-left: 0px; ">test-Werke GmbH</span></b>

                            </td>

                        </tr>
                    </table>

                    <table width="100%" border="0">
                        <tr>
                            <td width="15%">
                                <span class="cls_002">test-Werke testr testr 71-163 testr testr</span>
                            </td>
                            <td width="10%" align="right">
                                <span class="cls_002">Ihr Ansprechpartner:</span>
                            </td>
                            <br/>
                        </tr>
                        <tr>
                            <td width="15%">
                                <span class="cls_002">{!Contact.account.name}</span>
                            </td>
                            <td width="10%" align="right">
                                <span class="cls_002">{!$User.FirstName}</span>
                            </td>
                        </tr>
                        <tr>
                            <td width="15%">
                                <span class="cls_002">{!Contact.FirstName} {!Contact.LastName} </span>
                            </td>
                            <td width="10%" align="right">
                                <span class="cls_002"> {!$User.LastName} </span>
                            </td>

                        </tr>
                        <tr>
                            <td width="15%">
                                <span class="cls_002">{!contact.account.billingstreet}</span>
                            </td>
                            <td width="10%" align="right">
                                <span class="cls_002"> Customer Service</span>
                            </td>
                        </tr>
                        <tr>
                            <td width="15%">
                                <span class="cls_002">{!contact.account.billingpostalcode} {!contact.account.billingcity} </span>
                            </td>
                            <td width="10%" align="right">
                                <span class="cls_002">Phone: {!$User.Phone} </span>
                            </td>
                        </tr>
                        <tr>
                            <td width="15%">
                                <span class="cls_002">{!contact.account.billingcountry}</span>
                            </td>
                            <td width="10%" align="right">
                                <span class="cls_002">Fax: {!$User.Fax}</span>
                            </td>
                        </tr>
                        <tr>
                            <td width="15%">
                                <span class="cls_002">&nbsp;</span>
                            </td>
                            <td width="10%" align="right">
                                <span class="cls_002"> {!$User.Email}</span>
                            </td>
                        </tr>
                        <tr>
                            <td width="15%">
                                <span class="cls_002">&nbsp;</span>
                            </td>
                            <td width="10%" align="right">
                                <span>testr:</span>
                                <apex:outputText value="{0,date,dd'.'MM'.'yyyy}">
                                    <apex:param value="{!today()}" />
                                </apex:outputText>

                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            
            <div class="footer">
                <div>Page <span class="pagenumber"/> of <span class="pagecount"/></div>
         <hr/>
         <div>
                <table width="100%">
                    <tr>
                        <td>
                            <span class="cls_002">test-Werke testr</span>
                        </td>
                        <td>
                            <span class="cls_002">testr</span>
                        </td>
                        <td>
                            <span class="cls_002">testr</span>
                        </td>
                        <td>
                            <span class="cls_002">info@testgroup.com</span>
                        </td>

                    </tr>
                    <tr>
                        <td>
                            <span class="cls_002">testr 71-163</span>
                        </td>
                        <td>
                            <span class="cls_002">testr testr</span>
                        </td>
                        <td>
                            <span class="cls_002">testr testr:testr</span>
                        </td>
                        <td>
                            <span class="cls_002">www.testr.com</span>
                        </td>

                    </tr>
                    <tr>
                        <td>
                            <span class="cls_002">D-testr testr</span>
                        </td>
                        <td>
                            <span class="cls_002">testr testr</span>
                        </td>
                        <td>
                            <span class="cls_002">testr:testr testr</span>
                        </td>
                        <td>
                            <span class="cls_002">&nbsp;</span>
                        </td>

                    </tr>
                    <tr>
                        <td>
                            <span class="cls_002">&nbsp;</span>
                        </td>
                        <td>
                            <span class="cls_002">testr.testr testr</span>
                        </td>
                        <td>
                            <span class="cls_002">&nbsp;</span>
                        </td>
                        <td>
                            <span class="cls_002">&nbsp;</span>
                        </td>

                    </tr>
                </table>
                </div>
                </div>
                <div class="content" style="border-style: double" >
                </div>
                        </body>
    </apex:form>
</apex:page>

sample out put:User-added image
I've gone through every step successfully but am banging my head against the wall with step 8. I have more than adequate code coverage but continue to get this error message:
User-added image
I have gone back and rewritten OrderTests twice according to the requirements but can't get past this error. Anyone else had any luck with this?

Here's my code for reference:
@isTest (SeeAllData=false)
private class OrderTests {
    
    static void SetupTestData() {
	    TestDataFactory.InsertTestData(5);
    }
 
    @isTest static void OrderExtension_UnitTest() {
        PageReference pageRef = Page.OrderEdit;
        Test.setCurrentPage(pageRef);
        SetupTestData();
        ApexPages.StandardController stdcontroller = new ApexPages.StandardController(TestDataFactory.orders[0]);        
        OrderExtension ext = new OrderExtension(stdcontroller);        
       	System.assertEquals(Constants.DEFAULT_ROWS, ext.orderItemList.size());
        ext.OnFieldChange();
        ext.SelectFamily();
        ext.Save();
        ext.First();
        ext.Next();
        ext.Previous();
        ext.Last();
        ext.GetHasPrevious();
        ext.GetHasNext();
        ext.GetTotalPages();
        ext.GetPageNumber();
        List<SelectOption> options = ext.GetFamilyOptions();
    }
    
@isTest
public static void OrderUpdate_UnitTest(){
    setupTestData();
    
   
    Test.startTest();
    
    List<Order> orders = TestDataFactory.orders;
    for (Order o : orders){
        o.Status = Constants.ACTIVATED_ORDER_STATUS;
    }
    List<Product2> oldProducts = TestDataFactory.products;
    Set<Id> productIds = new Set<Id>();
    for (Product2 oldProd : oldProducts){
        productIds.add(oldProd.Id);
    }
    oldProducts = [SELECT Id, Quantity_Ordered__c FROM Product2 WHERE ID IN :productIds];
    Map<Id, Integer> quantities = new Map<Id, Integer>();
    for (OrderItem oi : TestDataFactory.orderItems){
        Integer quantity = 0;
        List<PricebookEntry> pricebookentries = TestDataFactory.pbes;
        for (PricebookEntry pbe : pricebookentries){
            if (oi.PricebookEntryId == pbe.Id){                
                if (quantities.containsKey(pbe.Product2Id)){
                    quantity = quantities.get(pbe.Product2Id);
                }
                quantity += (Integer)oi.Quantity;
                quantities.put(pbe.Product2Id, quantity);
                break;
            }
        }
    }
   
    update orders;
    Map<Id, Product2> currentProducts = new Map<Id, Product2>([Select Id, Quantity_Ordered__c FROM Product2 WHERE Id IN :productIds]);
  
    for (Product2 prod : oldProducts){
      
        TestDataFactory.VerifyQuantityOrdered(prod, currentProducts.get(prod.Id), quantities.get(prod.Id));
  }
  Test.stopTest();
}
}

 
Hi,
I have a requirement to set focus and out focus for an UI:inputIText field on click of a button in lightning component. How I can achieve this?

I tried -  component.find('myText').element().blur();
but this does not work.

Thanks in advance,
Vinay