Skip to main content

#Java Development2 discussing

Hi how can i remove duplicate from list of object ! i try like this but it's doesn't work 

 

public static List<State__c> getState(){

List <State__c> first = [SELECT Id,Name,Child__r.Name FROM State__c];

List<State__c> uniqueValue = new List<State__c>();

Set<State__c> myset = new Set<State__c>();

for (State__cs : first) {

if (myset.add(s)) {

uniqueValue.add(s);

}

}

return uniqueValue;

}

my list is like this :

 

suucces[{"Id":"a0b5E000002VSuXQAW","Name":"Abbes","Child__c":"a0Z5E000002s12BUAQ","Child__c":{"Name":"Abbes","Id":"a0Z5E000002s12BUAQ"},"Public__c":true},{"Id":"a0b5E000002VSajQAG","Name":"Abbes","Child__c":"a0Z5E000002s12BUAQ","Child__r":{"Name":"Abbes","Id":"a0Z5E000002s12BUAQ"},"Public__c":true}]

2 answers
  1. Apr 24, 9:54 AM

    Tried this but it didn't work ?

0/9000

Hi all

It's very important I don't know anything about coding. I want to import my Excel file to my custom object Sample c to create new records using visual force page, but I can't figure out how to do it.

I have an Excel file with columns for Name, Email, and Phone, and I need to import the values to Sample c fields Name c, Email c, and Phone c. However, I can't do this, and I need help from experts because I've already tried all the links related to this and now I need the full code and unable to uninstall openvas (https://howisland.com/how-to-uninstall-openvas/).

Thanks f
2 answers
  1. Nov 23, 2025, 7:14 PM

    If you don’t code, building a full VF upload page from scratch is going to be tough, since you’d need both the page and an Apex controller to parse the CSV and insert the records. For a quick win, most folks just import the file with Data Import Wizard or an external tool and skip the VF route entirely. If you ever want to automate it later without writing Apex, Skyvia (https://skyvia.com/data-integration/salesforce-csv-file-import-and-export) can also handle simple CSV-to-Salesforce loads into custom objects with field mapping built in.

0/9000
Hi, i am new to salesforce is it possible to reference a sObject to Object

Object obj=new sObject(); , 
4 answers
  1. Aug 30, 2025, 2:45 PM

    #Agentforce #Flow

     

    I am working on Agentforce agent, I have create a custom topic to get contact details for given account but the flow is working fine when we are debuging it, but when I have intergate that flow with agent it is not working, it is give me the below error. 

     

    I am working on Agentforce agent, I have create a custom topic to get contact details for given account but the flow is working fine when we are debuging it, but when I have intergate that flow with a

     

     

    error message.PNG

     

     

0/9000
I am a begenner to salesforce and I have been asked to investigate about sending emails to individual users whenever they place a new order in our internal application. The idea is to call the salesforce api from our java application to send email to the specified single user at that time.

I got the WSC project and created the jar files from WSDL and tried sending email with both single email message and mass email message. In both cases emails are sent to the user. but specified templates are used for mass email messages only. The body is empty for the single email message or if specified the plain text is sent as the body.

Could you please advice me which one I should use for our scenario.

And why template is not used with single email message

Rgards

Kumaran
2 answers
0/9000
We are subscribing to Push Topics and Platform Events using CometD Subscriber using the code in the EMP Connector provided on GitHub.

Scenario:

Take the case of a subscriber listening on channel /topic/channel. The replayId is -1

Lets say the subscriber received messages upto replayId 20 and then due to some reason the subscriber went down and then came up and started listening on the channel again

In the time the subscriber was down four new events were published. But when the subscriber comes up it will start receiving messages from 25 since the replay id is -1

Question : Is there any way to ensure that the subscriber starts listening from id 21 when it comes up. 

I know that one way is to give the replay id as 21. But that is not suitable for our application

Is there a way to query salesforce through cometD or any SOAP/REST API to check the last received event's replayID and then start the subscriber from that. 

Can we use EventBusSubcriber for this? I started our application and subscribed to a platform event through cometd and tried querying the entries in EventBusSubcriber. But it did not have any entries
2 answers
  1. Jul 8, 2024, 1:59 PM

    Hi ,

     

    I am also facing same issue . Do we have any solution to get the events from last processed event?

     

    Thanks,

    Priyanka

0/9000
Hello Experts,

I have registered my app. Could you please help in letting me know how to get:

1. client_id,

2. client secret, and

3. security token

I am trying to implement Oauth pragramatically so that I can use REST API.

Could you please help.

Thanks,

Rakesh
17 answers
  1. May 13, 2024, 10:13 AM

    1. Navigate to Setup> App Manager > Create new App

    1.1 Enable OAuth Settings

    1.2 Enable for Device Flow

    1.3 Select OAuth scope

    2. Click Save

    3. Wait for 10 mins

    4. Navigate to App Manager, click view from drop-down of your created app

    5. Click Manage Consumer Details

     

    That way you'll get Consumer Key and Consumer secret for Connected app

0/9000

Hi, i've been working on this for the past 3 days and I can't seem to work it out. Ive downloaded the latest Java 17.0 for apex to work on my org in Visual studio. Unfortunately, the system can't seem to find it and the video provided didn't walk through that step. I'm just not entirely sure what i'm exactly am I doing wrong. Pls help. 

I can't find my Java to work on Visual studio code

 

#Trailhead Challenges  #Salesforce  #Apex  #Java Development  #Apple Mac and OS X

We are trying to use the E2Excel "Export to Excel" button (downloaded from the App Exchange) on custom objects and it seems to work if you include it directly on the object, but when we try to lauch the button from a 'Related List' we are getting an error message: 

A problem with the OnClick JavaScript for this button or link was encountered: Cannot read property 'value' of undefined

I have very little experience with Java but here is the code they included in the instructions for installation of the botton on the object:

var str = parent.location.href;

var sobjid=str.substring(str.indexOf("?fcf")-3,str.indexOf("?fcf"));

var idArray = {!GETRECORDIDS('selected')};

var listview = document.getElementsByName('fcf')[0];

var listId = listview.value;

var listName = listview.options[listview.selectedIndex].text;

var idString = JSON.stringify(idArray);

window.open('apex/E2Ex__Export_To_Excel?idString='+idString+'&sobjid='+sobjid+'&listid='+listId+'&listName='+listName);

Again, it has worked 'as expected' when added to the Object. But when trying to use it from a 'related list' we get the error message. The buttom appears on the Related List next to the "New" button. Any help you can offer to sort this out, would be greatly appreciated. 
4 answers
0/9000
I get the following error when downloading salesforce project to eclipse

"Could not find https://developer.salesforce.com/media/force-ide/eclipse45"

"Unable to connect to repository https://developer.salesforce.com/media/force-ide/eclipse45/compositeContent.xml

Unable to connect to repository https://developer.salesforce.com/media/force-ide/eclipse45/compositeContent.xml

Connection timed out: connect"

My salesforce credentials are 100% correct.

Eclipse Version: Oxygen Release (4.7.0)

Build id: 20170620-1800

Any help? Could you please provide step by step instructions please..

Thanks

Unable to download Salesforce project to Eclipse
9 answers
  1. Jul 17, 2017, 7:49 PM
    Hi Rakesh:

    Step by Step:https://developer.salesforce.com/docs/atlas.en-us.eclipse.meta/eclipse/ide_install.htm

    Regarding your error :Configure Eclipse to use your proxy server. These settings can be found in your Eclipse Preferences, under General > Network Connections."

    https://developer.salesforce.com/forums/?id=906F0000000AqhIIAS

    https://stackoverflow.com/questions/1500646/eclipse-3-5-unable-to-install-plugins

    Can you please Let me know if it works or not!!!

    If it helps don't forget to mark this as a best answer!!!

    Thanks,

    ​Raj
0/9000
I want to upload a file to content version using Rest API. As of now i achieved to do using REST API with java code. Code is uploading till 35 MB single file and no more than that. Code is throwing 400 status code.

Please suggest me its possible to upload a file more than 100+MB file. If its  YES, then where i got stuck. looking forward from team if any one faced same situation.

.

 
4 answers
  1. Mar 17, 2020, 12:50 PM
    Hi Sunil,

    You must be hitting the following limit

    "You can insert or update blob data using a non-multipart message, but if you do, you are limited to 50 MB of text data or 37.5 MB of base64–encoded data and that is the reason you are not able to load the content version via Rest api"

    https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm⌗inserting_a_contentversion

    Did you try using any other way of loading other than using Java cide? This should be possible using any tools capable of generating multipart POST requests (e.g. Curl, Fiddler, C⌗/.NET client applications, etc.).

    In multipart message the first part of the request message body contains non–binary field data such as the Description or Name. The second part of the message contains the binary data of the file that you're uploading.

    Example for creating a new Document via curl:

    curl https://na1.salesforce.com/services/data/v23.0/sobjects/Document/ -H "Authorization: Bearer token" -H "Content-Type: multipart/form-data; boundary=\"boundary_string\"" --data-binary @newdocument.json

    Example request body for creating a new Document

    This code is the contents of newdocument.json. Note that the binary data for the PDF content has been omitted for brevity and replaced with “Binary data goes here.” An actual request will contain the full binary content.

    --boundary_string

    Content-Disposition: form-data; name="entity_document";

    Content-Type: application/json

    {

    "Description" : "Marketing brochure for Q1 2011",

    "Keywords" : "marketing,sales,update",

    "FolderId" : "005D0000001GiU7",

    "Name" : "Marketing Brochure Q1",

    "Type" : "pdf"

    }

    --boundary_string

    Content-Type: application/pdf

    Content-Disposition: form-data; name="Body"; filename="2011Q1MktgBrochure.pdf"

    Binary data goes here.

    --boundary_string--

    Example response body for creating a new Document

    On success, the ID of the new Document is returned.

    {

    "id" : "015D0000000N3ZZIA0",

    "errors" : [ ],

    "success" : true

    }

    If this is failing with other apps as well, we know you are hitting the limit. Otherwise there could be an issue with Java code

    Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. Thank you!

    Anudeep

     
0/9000