• Ankit Arora 29
  • NEWBIE
  • 0 Points
  • Member since 2018
  • Systems Developer

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 4
    Replies

Hello Everyone,

I have created a Flow that fetches the data from one field separated by Semi-Colon like aaaa;bbbb;cccc, etc. and this length is not fixed but I am not expecting more than 4 or 5 values in this field.

These are some codes, so I wanted to copare these codes with a Scholarship object and there is no relationship between Opportunity and Scholarship Object.

Currently, I am adding one more ";" into the end of this field and then fetch the First values and then store it in a variable, then removing it from the original field and then doing it for other values one by one.

Once I get all the fields and not separated by Semi-Colon anymore, I am looping through each and then there is a inner loop that is comparing this with all the scholarships and fetch the description if there is a match but this inner loop is even workingand completing all the iteration even it finds the value.

Then I want to put these scholarship descriptions stored in the Assignment "ScholarshipDescriptionList" to multiple fields in Salesforce and I know that we can't find values by the index in Collection variable but if there is any work around? I only have 4-5 fields in this collection variable, so I tried to create multiple decision ​​​​outcomes but I was not sure who to matches it.​​​Flow

Need Help.
Thank you

Regards,
Ankit
Hi Everyone,
 
There is a Text field called Scholarship Name that has data in the form of SemiColon like aaaa;bbbb;cccc;dddd. 
This above length is not fixed, it can have one more value in it.
 
I am new in terms of coding and I tried to create a Trigger which is working in Sandbox. Can someone help me to optimize the code and also how to write a test class so that it can pass the validation test. This data in Scholarship name is going to be split and then compare it with the data in the Scholarship Object and fetch the descriptions and stored it in the Scholarship1, Scholarship2, Scholarship3 and Schorship4 fields. Please find below the code I have written. 
 
APEX TRIGGER: 
 
trigger OpportunityTrigger on Opportunity (before insert, before update) {
if(Trigger.isBefore){
if(Trigger.isInsert){
OpportunityScholarshipHandler.updateScholarCodesToNames(Trigger.New);
}
if(Trigger.isUpdate){
OpportunityScholarshipHandler.updateScholarCodesToNames(Trigger.New);
}
}
}

 
 -----------
 
APEX CLASS:
 
public class OpportunityScholarshipHandler {
public static void updateScholarCodesToNames(List<Opportunity> newOpp){
List<String> scholarCode = new List<String>();
List<Scholarship__c> scholarName = new List<Scholarship__c>();
for (Opportunity opp : newOpp){
if(opp.Scholarship_Name__c != NUll){
scholarCode = opp.Scholarship_Name__c.split(';');
}
scholarName = [Select Scholarship_Description__c from Scholarship__c where Scholarship_Code__c IN :scholarCode];
if(scholarName.size() == 4){
opp.Scholarships1__c = String.valueOf(scholarName[0].Scholarship_Description__c);
opp.Scholarships2__c = String.valueOf(scholarName[1].Scholarship_Description__c);
opp.Scholarships3__c = String.valueOf(scholarName[2].Scholarship_Description__c);
opp.Scholarships4__c = String.valueOf(scholarName[3].Scholarship_Description__c);
}
if(scholarName.size() == 3){
opp.Scholarships1__c = String.valueOf(scholarName[0].Scholarship_Description__c);
opp.Scholarships2__c = String.valueOf(scholarName[1].Scholarship_Description__c);
opp.Scholarships3__c = String.valueOf(scholarName[2].Scholarship_Description__c);
}
if(scholarName.size() == 2){
opp.Scholarships1__c = String.valueOf(scholarName[0].Scholarship_Description__c);
opp.Scholarships2__c = String.valueOf(scholarName[1].Scholarship_Description__c);
}
if(scholarName.size() == 1){
opp.Scholarships1__c = String.valueOf(scholarName[0].Scholarship_Description__c);
}
scholarCode.clear();
scholarName.clear();
}
}
}

 
FYI: There is no relationship between Scholarship and Opportunity objects.
 
Thank you
 
Regards,
Ankit
Hi Everyone,

I need some help. I want to integrate Salesforce with some other company. They have provided me documentation with the following details:

Server URL,
Test API page URL,
API for create, read, delete and update.

I have API Create in JSON format. I don't have any endpoint URL that I can use in the Apex code. I am not sure what I need to do with these APIs. I am this integration for the first time.

Let's say after I create this user who will attend this event, I want to display this user in salesforce that this person attended the event.

I checked online but everyone is using endpoint url and I have only server url.

Please help me.
Thank you

Regards,
Ankit
Hello Everyone,

I have two Custom Objects, "Contacts" and "Events". I have multiple contacts associated with multiple Events. So I have created a new "Junction Object - ContactEvent". Now I have created a Master-Details relationship between "ContactEvent & Contacts" and other Master-Detail relationship between "ContactEvent & Events". There are no issues till now.
But I want to migrate data into the salesforce that has Many to Many relationships between Contact and Event, Can you please guide me how to do it? I studied about using Data Loader but we have to import the data and then export it to get Salesforce ID and again match it with the required field and then import it back again, this is a very lengthy process specially when we have millions of records. Is there any other way we can do it using External ID? like not exporting and we can use upsert, insert or update only the new records without exporting
Please let me know. Thank you so much.
Hello Everyone,

I have two Objects, one is Contact and other is Project. I want to link contact and project. As we know there are so many people work on one project and also 1 person works on multiple projects.
So i want to create many to many relationship.
for example I am working on a project "XYZ" and I am project manager and there are so many contacts working on same project like team members and we all are part of contact object.
Also, I am and other team members are also working on other projects like "XYZ", "UVW" etc and these project are part of project object.
so how to make relationship like this. Please I need help. Thank you so much.
I have a created a custom object. I want the user to type the Salutation, FirstName, and LastName and after saving, it shows up the entire name in one Name field as it happens in Standard Contact Object. I have created a formula field to merge FirstName and LastName into a "Name" field and it's displaying me the full name in one Name field. My main concern that it should work like the same way it work in contact object like before saving we get an option to type Salutation, FirstName, and LastName but after saving, it shows me only one field. I want my entire name should show up at the top of the record page not only my first name. I also tried compact layout to show up my entire name at the top but it didn't work as I am working in Salesforce Classic. Please let me know how to do it. Thank you so much.
Hi Everyone,
 
There is a Text field called Scholarship Name that has data in the form of SemiColon like aaaa;bbbb;cccc;dddd. 
This above length is not fixed, it can have one more value in it.
 
I am new in terms of coding and I tried to create a Trigger which is working in Sandbox. Can someone help me to optimize the code and also how to write a test class so that it can pass the validation test. This data in Scholarship name is going to be split and then compare it with the data in the Scholarship Object and fetch the descriptions and stored it in the Scholarship1, Scholarship2, Scholarship3 and Schorship4 fields. Please find below the code I have written. 
 
APEX TRIGGER: 
 
trigger OpportunityTrigger on Opportunity (before insert, before update) {
if(Trigger.isBefore){
if(Trigger.isInsert){
OpportunityScholarshipHandler.updateScholarCodesToNames(Trigger.New);
}
if(Trigger.isUpdate){
OpportunityScholarshipHandler.updateScholarCodesToNames(Trigger.New);
}
}
}

 
 -----------
 
APEX CLASS:
 
public class OpportunityScholarshipHandler {
public static void updateScholarCodesToNames(List<Opportunity> newOpp){
List<String> scholarCode = new List<String>();
List<Scholarship__c> scholarName = new List<Scholarship__c>();
for (Opportunity opp : newOpp){
if(opp.Scholarship_Name__c != NUll){
scholarCode = opp.Scholarship_Name__c.split(';');
}
scholarName = [Select Scholarship_Description__c from Scholarship__c where Scholarship_Code__c IN :scholarCode];
if(scholarName.size() == 4){
opp.Scholarships1__c = String.valueOf(scholarName[0].Scholarship_Description__c);
opp.Scholarships2__c = String.valueOf(scholarName[1].Scholarship_Description__c);
opp.Scholarships3__c = String.valueOf(scholarName[2].Scholarship_Description__c);
opp.Scholarships4__c = String.valueOf(scholarName[3].Scholarship_Description__c);
}
if(scholarName.size() == 3){
opp.Scholarships1__c = String.valueOf(scholarName[0].Scholarship_Description__c);
opp.Scholarships2__c = String.valueOf(scholarName[1].Scholarship_Description__c);
opp.Scholarships3__c = String.valueOf(scholarName[2].Scholarship_Description__c);
}
if(scholarName.size() == 2){
opp.Scholarships1__c = String.valueOf(scholarName[0].Scholarship_Description__c);
opp.Scholarships2__c = String.valueOf(scholarName[1].Scholarship_Description__c);
}
if(scholarName.size() == 1){
opp.Scholarships1__c = String.valueOf(scholarName[0].Scholarship_Description__c);
}
scholarCode.clear();
scholarName.clear();
}
}
}

 
FYI: There is no relationship between Scholarship and Opportunity objects.
 
Thank you
 
Regards,
Ankit
Hi Everyone,

I need some help. I want to integrate Salesforce with some other company. They have provided me documentation with the following details:

Server URL,
Test API page URL,
API for create, read, delete and update.

I have API Create in JSON format. I don't have any endpoint URL that I can use in the Apex code. I am not sure what I need to do with these APIs. I am this integration for the first time.

Let's say after I create this user who will attend this event, I want to display this user in salesforce that this person attended the event.

I checked online but everyone is using endpoint url and I have only server url.

Please help me.
Thank you

Regards,
Ankit
Hi,
I'm trying consume a Rest API of another system using apex, but I don't know how do that.
I'm reading and following the steps of the Trailhead (REST and SOAP Integration) but this is not clearly for me.

So my ideia is:
Consume Rest API from another system and make a GET request (Thats include the authentication of the another system).
I don't know which exactly code the apex accept, so I'm totaly lost.
if someone can help me, telling me the steps I need to do and some GET code for example that include authentication, will help me a lot.

Someone can help me with this issue?

Best Regards
Rafael
Dear all, I`m new to Apex REST/SOAP web services world and I`m struggling with a project of integration. What I have a API documentation from client which contains cURL examples, fields and sample JSON response. My questions,
1) How should I start and how can I call this API data inside Salesforce? I need ability to pull and push the data into Salesforce.
2) Are there any changes that need to do in external API system or can I call web services directly in Salesforce if I have login ID and Password of API?
3) In integration projects like this, what should be first step? What information will I need from client to start the integration?
 
I have read few articles online on REST but none of the article provide real time examples. Can you Apex Gurus please help? Any help is much appreciated.