• Meena25
  • NEWBIE
  • 30 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 24
    Replies
setScale(2) doesn't work for me. If the amount is 53, i want 53.00, if it is 53.1, i want it to show as 53.10 but currently it shows as only 53 or 53.1, it cuts off the zero.

Please see my code below;

public class BillAndPayWrapper {
        @AuraEnabled public DateTime postDate;
        @AuraEnabled public String   billPeriod;
        @AuraEnabled public Boolean  showSuccess;
        @AuraEnabled public String      invoice;
        @AuraEnabled public Decimal  amount;
        @AuraEnabled public String      amount_formatted;
        @AuraEnabled public String   docType;
        @AuraEnabled public String      pdfDocURL;
       
        BillAndPayWrapper(BillingHistoryServiceSet__x billPay, String companyCode) {
            this.postDate      = billPay.PostingDate__c;
            this.invoice      = billPay.InvoiceNo__c;
            this.amount      = billPay.TotalDueAmt__c.setScale(2);
            this.billPeriod  = billPay.BillPeriod__c;
            this.billPeriod = this.billPeriod.right(2) + '/' + this.billPeriod.left(4);

            if (amount<0) {
                amount=amount*-1;
                this.amount_formatted = '($' + String.valueOf(amount.format()) + ')';
                showSuccess=true;
            }
            else  this.amount_formatted = '$' + String.valueOf(amount.format());

please note: external object amount field data type is number
BillAndPayWrapper(BillingHistoryServiceSet__x billPay, String companyCode) {
            this.postDate      = billPay.PostingDate__c;
            this.invoice      = billPay.InvoiceNo__c;
            this.amount      = billPay.TotalDueAmt__c.setScale(2);
            this.billPeriod  = billPay.BillPeriod__c;

billPeriod is string and BillPeriod__c field under external object is data type text . It is external data and i get it as YYYY/MM. But i need to format it to MM/YYYY
I have three buttons which are currently displayed in an unorderly fashion and i tried various css styling options but it didn't work
System.JSONException: Apex Type unsupported in JSON: Schema.SObjectType (through reference chain: common.api.soap.wsdl.FieldSet["sobjectType"])

Schema.FieldSet fs1 = Schema.SObjectType.Lead.fieldSets.getMap().get('CreateLeadElmoService');
system.debug('fs1 -->' + fs1);
string body = JSON.serialize(fs1);

I am unable to serialize my fieldset. please suggest solutions.

This is my JSON body which am posting to backend.

{"attributes":{"type":"Lead","url":"/services/data/v46.0/sobjects/Lead/00Q6C00000MWXCgUAP"},"LastName":"rf","FirstName":"wq","Id":"00Q6C00000MWXCgUAP","RecordTypeId":"0121U000000jV0pQAE"}

I just need to replace Id with LeadId while posting as my backend expects that. How can i replace that JSON body text?

request.setBody('"lead":{"leadId":" "},{"firstName":"FN1"},{"lastName":"LN2"},{"ssn":"2"}');

I need to send values from salesforce to endpoint, am able to make the connection, however i see null values. I need to be able to pass more fields and corresponding values of lead object. Could someone help me how to use(send) multiple parameters in request.setBody?
I have used the formula NOW() to update a field based upon criteria. I need to add second ss to that. Please suggest a solution.

I am getting this error on line 0 in my apex code. This is for spring '19 PD1 maintenance

@RestResource(urlMapping='/secureApexRest')
global with sharing class SecureApexRest {
    @HttpGet
    global static Contact doGet(){
        Id recordId = RestContext.request.params.get('id');
        Contact result;
        if (recordId == null){
            throw new FunctionalException('Id parameter is required');
        }
        List<Contact> results;
        try{
            results = [SELECT id, Name, Secret_Key__c FROM Contact WHERE id=:recordId WITH SECURITY_ENFORCED];
        }catch(QueryException e){}
        
        if (!results.isEmpty()) {
            result = results[0];
        }
        return result;
    }
    public class FunctionalException extends Exception{}
    public class SecurityException extends Exception{}
}

Having issues with below code: Error not showing up on lightning component

If (ownerUser != null){
            AuraHandledException e = new AuraHandledException('The application is already with team');
               e.setMessage('The application is already with team');
               system.debug(e);
            //catch(AuraHandledException e){
            throw e;
            //}
            //throw new AuraHandledException('The application is already with team');
        }

ownerUser = [Select Id, UserRoleId from user where UserRoleId IN :lstUser AND Id = :opp.OwnerId]; 

This is causing me the exception, what is wrong with this?

When i click my custom button, a pop up window opens and again i have to click for me to perform the action and once processed, it doesn't get closed.

Two things here:

1)I don't want a pop up window, with only 1 click action should be performed

2)Once done window should be closed automatically

I have a custom button in lightning and whenever user clicks that, whoever clicks should be assigned with his namee. what is the query that i should use in Apex controller
Onclick of button, it should update the owner field in opportunity and then show a toast message for user. This is what i have in my helper class.
setScale(2) doesn't work for me. If the amount is 53, i want 53.00, if it is 53.1, i want it to show as 53.10 but currently it shows as only 53 or 53.1, it cuts off the zero.

Please see my code below;

public class BillAndPayWrapper {
        @AuraEnabled public DateTime postDate;
        @AuraEnabled public String   billPeriod;
        @AuraEnabled public Boolean  showSuccess;
        @AuraEnabled public String      invoice;
        @AuraEnabled public Decimal  amount;
        @AuraEnabled public String      amount_formatted;
        @AuraEnabled public String   docType;
        @AuraEnabled public String      pdfDocURL;
       
        BillAndPayWrapper(BillingHistoryServiceSet__x billPay, String companyCode) {
            this.postDate      = billPay.PostingDate__c;
            this.invoice      = billPay.InvoiceNo__c;
            this.amount      = billPay.TotalDueAmt__c.setScale(2);
            this.billPeriod  = billPay.BillPeriod__c;
            this.billPeriod = this.billPeriod.right(2) + '/' + this.billPeriod.left(4);

            if (amount<0) {
                amount=amount*-1;
                this.amount_formatted = '($' + String.valueOf(amount.format()) + ')';
                showSuccess=true;
            }
            else  this.amount_formatted = '$' + String.valueOf(amount.format());

please note: external object amount field data type is number
BillAndPayWrapper(BillingHistoryServiceSet__x billPay, String companyCode) {
            this.postDate      = billPay.PostingDate__c;
            this.invoice      = billPay.InvoiceNo__c;
            this.amount      = billPay.TotalDueAmt__c.setScale(2);
            this.billPeriod  = billPay.BillPeriod__c;

billPeriod is string and BillPeriod__c field under external object is data type text . It is external data and i get it as YYYY/MM. But i need to format it to MM/YYYY
I have three buttons which are currently displayed in an unorderly fashion and i tried various css styling options but it didn't work
System.JSONException: Apex Type unsupported in JSON: Schema.SObjectType (through reference chain: common.api.soap.wsdl.FieldSet["sobjectType"])

Schema.FieldSet fs1 = Schema.SObjectType.Lead.fieldSets.getMap().get('CreateLeadElmoService');
system.debug('fs1 -->' + fs1);
string body = JSON.serialize(fs1);

I am unable to serialize my fieldset. please suggest solutions.

This is my JSON body which am posting to backend.

{"attributes":{"type":"Lead","url":"/services/data/v46.0/sobjects/Lead/00Q6C00000MWXCgUAP"},"LastName":"rf","FirstName":"wq","Id":"00Q6C00000MWXCgUAP","RecordTypeId":"0121U000000jV0pQAE"}

I just need to replace Id with LeadId while posting as my backend expects that. How can i replace that JSON body text?

I have used the formula NOW() to update a field based upon criteria. I need to add second ss to that. Please suggest a solution.

I am getting this error on line 0 in my apex code. This is for spring '19 PD1 maintenance

@RestResource(urlMapping='/secureApexRest')
global with sharing class SecureApexRest {
    @HttpGet
    global static Contact doGet(){
        Id recordId = RestContext.request.params.get('id');
        Contact result;
        if (recordId == null){
            throw new FunctionalException('Id parameter is required');
        }
        List<Contact> results;
        try{
            results = [SELECT id, Name, Secret_Key__c FROM Contact WHERE id=:recordId WITH SECURITY_ENFORCED];
        }catch(QueryException e){}
        
        if (!results.isEmpty()) {
            result = results[0];
        }
        return result;
    }
    public class FunctionalException extends Exception{}
    public class SecurityException extends Exception{}
}

Having issues with below code: Error not showing up on lightning component

If (ownerUser != null){
            AuraHandledException e = new AuraHandledException('The application is already with team');
               e.setMessage('The application is already with team');
               system.debug(e);
            //catch(AuraHandledException e){
            throw e;
            //}
            //throw new AuraHandledException('The application is already with team');
        }

ownerUser = [Select Id, UserRoleId from user where UserRoleId IN :lstUser AND Id = :opp.OwnerId]; 

This is causing me the exception, what is wrong with this?

When i click my custom button, a pop up window opens and again i have to click for me to perform the action and once processed, it doesn't get closed.

Two things here:

1)I don't want a pop up window, with only 1 click action should be performed

2)Once done window should be closed automatically

When I write the code in the developer sandbox, it initially appears as though it is saving.  Yet, when I go to close the code I recieve the message: The tab "DrivingDistance1" has changes. Would you like to close without saving?

After I select 'Yes' because I know I have just saved I return to my code and it is all gone.  I have already attempted creating a new workspace.  What do I do?

Hi all,
I have an issue when I come to open my developer console. It opens and start to load but it quickly minimizes, showing a "loading..." text.
After that, the developer console's window freezes completely, allowing me only to close it. Same happens to the window I used to open the developer console. 
I find a solution here http://salesforce.stackexchange.com/questions/80453/developer-console-is-not-loading but I don't have enough time to switch my workspace.
I tried cleaning the browser data but nothing changed. I can also use the developer console of other salesforce accounts, so it seems it only happens with my account.


And I have another issue, I don't know if it's related or not, I'm posting it here just in case it is and it helps to see the problem.
As I couln't continue using the default developer console, I downloaded Welkin Suite, but when I build the solution, I keep getting an error that says "file has pending server changes. Please pull first", which it doesn't fix after a pull. When I'm not getting that error I get strage errors like "The attribute “(...)” was not found on the COMPONENT markup://(...): Origin"

Thanks in advance to anyone who can help me solving this!