At the moment however, it will only populate the table with the last entry it finds in the database query and what I'm trying to do requires them all to be present for further user interaction so I was hoping someone might know the best way to get all the results to display at once the loop is completed or a better way to restructure the loop to accomplish the same.
Need help with ERROR – Trigger Code and Test Code Below -Creating a "Project" Milestone1_Project__c record when an Opp custom field - Start_Project_Site_Id_Stage__c = Yes - This field is dependent upon Stage = "Closed Won" on the opportunity.
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CreateM1Project: execution of AfterInsert
caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ProjectMilestone: execution of AfterInsert
caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []
Trigger.ProjectMilestone: line 16, column 1: []
Trigger.CreateM1Project: line 16, column 1: [] Stack Trace Class.CreateM1Project_test.myTestMethod: line 14, column 1
TRIGGER CODE
trigger CreateM1Project on Opportunity (after insert, after update) {
List<Milestone1_Project__c> NewProjects = new List<Milestone1_Project__c>();
for (Opportunity opp: trigger.new) {
if (opp.Start_Project_Site_Id_Stage__c == 'Yes') {
Milestone1_Project__c freshProject = new Milestone1_Project__c();
trigger SD_Member_Check_Member_Status on SD_Member__c (after insert, after update) {
// If Master Status = Ineligible
// And Post Referral to CC Status = (In Treatment OR No Contact 30 Days OR No Contact 60 Days)
For (SD_Member__c SD : Trigger.new){
String MS1 = SD_Member__c.Master_status__c;
If(MS1 == 'Ineligible'){
}
}
}
The Issue is this line:
String MS1 = SD_Member__c.Master_status__c;
The Master_Status__c field is a Formula (Text) field and the formula is:
I am trying to call the webservice and getting the following error:
System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: <E97007> The supplied Zip+4 code of '87144' is invalid. faultcode=a:ApplicationException faultactor=
I get this error from a class generated from a WSDL in a sandbox org but using a dev org with the same WSDL I get a little more detailed info.
I'm trying to import a service WSDL that uses external schemas. I tried flatenning the WSDL but it uses 5 different xsds all with their own namespaces and all of them are qualified. I can try and change the name spaces but I think the service will not be able to recongnize it as the elements will not have any namespace qualifiers. Including xlms:"service url" might work but I'm not sure how to iclude a namespace in apex for a request generated by wsdl2apex.
Another option I'm trying to explore would make use of XML DOM class and HttpRequest/Response classes to manually build the SOAP enveloper and handle responses. Has any one had experiences using Http classes for SOAP callouts? What would the req.setMethod be?
I'm struggling with a very large SOQL implementation. Among other things, I have to search through 3+ million cases, most of which are closed and are not relevant to me.I'm trying to identify the best field to use to filter out these closed cases? Currently, out of the 3+ million we have around 70,000 open cases.
Salesforce only mentions that some of the standard fields are indexed, but doesn't exactly specify which fields.
In terms of query optimization, is it better to use isClosed=true or Status='Closed' or may be even both with an AND?
I'm trying to create a generic CSV reader that will read from a Blob into list of records. This class would be called from a controller. This is my first draft. Arguments include file, fieldnames which sort of acts as the map and then the object name. I want to be able to detect what the object is and then read the CSV into a list of records of that type. Not sure what I have here would work (since I'm using PUT method on the generic sObject)
public List<sObject> readCSVRecords(Blob fileContent,List<String> fieldNames,String objName){
Schema.SObjectType targetType = Schema.getGlobalDescribe().get(objName);
List<sObject> returnList=new List<sObject>();
if(fileContent!=NULL&fileContent.size()<MAXFILESIZE){ //currently limited to 2MB
fileString=fileContent.toString();
fileLines=fileString.split('\n');
fileLinesSize=fileLines.size();
for(Integer i=1;i<fileLinesSize;i++){ //leave out headings
String[] inputvalues = filelines[i].split(',');
Integer y=0;
sObject rec=targetType.newSObject(objName); //How do I cast this dynamically?
for(String s:fieldNames){
rec.put(s,inputvalues[y]);
y++;
}
returnList[i-1].add(rec);
}
return returnList;
}
else
return NULL;
}// end readCSVRecords
I'm struggling with the custom lightning component on this part. I don't have much background coding and am having trouble finding resources to help me achieve coding the lightning component. If someone could help give me some framework code to create a custom lightning component to hold a URL or direct me to a resource that help break this down I'd be very appreciative.
I'm struggling with a very large SOQL implementation. Among other things, I have to search through 3+ million cases, most of which are closed and are not relevant to me.I'm trying to identify the best field to use to filter out these closed cases? Currently, out of the 3+ million we have around 70,000 open cases.
Salesforce only mentions that some of the standard fields are indexed, but doesn't exactly specify which fields.
In terms of query optimization, is it better to use isClosed=true or Status='Closed' or may be even both with an AND?
I get the here-above message when trying to update opportunities.
When looking at the API guide, it seems to be specific to Person Accounts errors but I do not have Person Accounts enabled.
I could also see other threads but did not get any help for my specific scenario.
Debug Log lines:
15:41:54.093 (93278000)|DML_BEGIN|[42]|Op:Update|Type:Opportunity|Rows:1
15:41:54.126 (126267000)|DML_END|[42]
15:41:54.126 (126412000)|EXCEPTION_THROWN|[42]|System.DmlException: Update failed. First exception on row 0 with id 006S00000070MRG; first error: INVALID_FIELD_FOR_INSERT_UPDATE, Opportunity: bad field names on insert/update call: type: [type]
15:41:54.133 (133797000)|POP_TRACE_FLAGS|[EXTERNAL]|01pS0000000EZwQ|ClosedDuplicate|
15:41:54.204 (133826000)|CUMULATIVE_LIMIT_USAGE
15:41:54.204|LIMIT_USAGE_FOR_NS|(default)
Apex Class:
global class ClosedDuplicate{
webService static String myMethod(Opportunity contextOpp) {
List<Opportunity> relevantOpps;
String finalMessage;
Profile userProfile = [SELECT Name FROM Profile WHERE Id = :Userinfo.getProfileId()];
/*********************************************************/
/*****************AUTHORIZED USER ************************/
/*********************************************************/
if(contextOpp.Owner.Name == 'NA BS User') {}
if ( /* (userProfile.Name.equals('NA Telesales Rep') ||
userProfile.Name.equals('Na Telesales Manager') ||
userProfile.Name.equals('NA Territory Manager - Outbound')) &&
contextOpp.Owner.Name == 'NA BS User' */ true )
{
List<Opportunity> oppsToUpdate = new List<Opportunity>();
oppsToUpdate.add(contextOpp);
try{
relevantOpps = [SELECT Id,StageName,Reason_For_Closed_Lost__c FROM Opportunity WHERE
AccountId = :contextOpp.AccountId AND
IsClosed = false AND
Owner.Name like 'NA BS User' AND
Product_Target__c INCLUDES ('Advanced','ECS','Pro')];
oppsToUpdate.addAll(relevantOpps);
} catch(Exception e){
finalMessage = 'No relevant opportunities have been closed because either none were found or an error has happened.';
}
if(oppsToUpdate.size() > 0)
{
for (Opportunity o : oppsToUpdate)
{
o.StageName = 'Closed Lost';
o.Reason_For_Closed_Lost__c = 'Close - TS Duplicate';
}
try{
update oppsToUpdate;
finalMessage = oppsToUpdate.size() + ' opportunities have been closed';
} catch(Exception e){
finalMessage = 'No relevant opportunities have been closed';
}
}
}
/*********************************************************/
/********************NON-AUTHORIZED USER *****************/
/*********************************************************/
else{
finalMessage = 'No relevant opportunities have been closed because you do not have an authorized profile or the opportunity is not owned by NA BS User.';
}
return finalMessage;
}
}
Is there a way for a trigger to tell if edits to records are from a mass upload/edit?
I have a trigger that recalculates lat/long fields when the address of an account is changed, but I know the trigger will give me problems when I try to upload or edit accounts en masse because of the 10 query limit.
So I need to figure out how to create a trigger that will update the fields when users change the addresses one at a time, but still allow a mass update or edit to do the same without triggering errors.
I'm wondering if someone out there with more experience has tried to do something like this before, or have any ideas?
I am passing a long text box that contains a copy of an email to a VF page that renders a PDF but the formatting is distorted. I want it to keep the format and stucture of the saved text in the comments box. This would look as the email was because this is my way of printint the email.
I want to take pre-determind fields from a custom object and create a professsional PDF document. I have created a button and a visualforce page with fields from the object. It works but Im not satisfied with the look of the document. It just lists the text in a column.
Anyone reading this post would you be so kind in shainge your code with me? I have attached a link of what I am looking for.
wonder if anyone can help me out with a problem that i have when inserting a .CSV through Visualforce to opportunity... i have a Lookup field : -
o.BrokerSalesAgent__c = inputvalues[4];
which need to link an custom object which contains existing records that i want to link to via the name of the record. I have managed to link this through by using the record ID on the .csv but i have a 3rd party that will not have access to record ID's.
when try to use the name of the record i get the following error message: -
Visualforce Error
Help for this Page
System.StringException: Invalid id: Sean Broker Team
Error is in expression '{!ReadFile}' in component <apex:commandButton> in page uploadop
Class.FileUploadOpp.ReadFile: line 33, column 1
I know that i have to write some code to search for the existing records (ID,Name) but not sure how to approach this?
the code below shows the inputvalues from my .csv file mapping them to the fields in the opportunity object.
Need help in understanding if we can invoke an existing apex class created by consuming an external system WSDL using outbound messages? So if i create a workflow to send an outbound message to a webservice on the same org and this webservice calls the other apex class that we created by consuming the WSDL, will it work?
At the moment however, it will only populate the table with the last entry it finds in the database query and what I'm trying to do requires them all to be present for further user interaction so I was hoping someone might know the best way to get all the results to display at once the loop is completed or a better way to restructure the loop to accomplish the same.
when i change a picklist value to 'approved', a workflow rule will run to send an email to my list of contacts. How can i add the attached file from the 'Notes and Attachments' related list of the record to the email/email template that will be sent when the rule is fired.
I'm developing a new service and thinking of using REST instead of SOAP. This service will be called internally by another application that runs in the background, i.e., no human user, no web browser.
I'm trying to figure out the best what for the client application to authenticate. The client application already knows how to connect via the regular login() API and get a session ID. I'm thinking the easiest thing to do would be to just use that Session ID.
What I don't know is how the client should pass the Session ID to a REST service.
When calling a SOAP Web Service, it goes in the <cus:sessionId> tag in the <soapenv:Header>. That wouldn't exist in REST. I guess it isn't passed as a parameter and has to go in some sort of authentication header. Can anyone point me to documentation on how to compose that header?
Right now, I just want to test a call from SoapUI. Then I'll have to tell the people that write the client app what to do.