• Meena25
  • NEWBIE
  • 20 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 19
    Replies
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.
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!