-
ChatterFeed
-
40Best Answers
-
0Likes Received
-
6Likes Given
-
4Questions
-
288Replies
Is it possible to upload a package without any unit tests?
Is there a way around the unit test coverage requirement? Is there a better way to back up and restore my work around the Sandbox refresh?
- Zoe Hart
- November 19, 2019
- Like
- 0
- Continue reading or reply
how to fetch my content of my document
I need to fetch my content of my document which is uplaoded to the attachment.
I need to pass the query in REST API through workbench
So far I tried , Select id,ContentDocumentId,ContentDocument.LatestPublishedVersionId from ContentDocumentLink where LinkedEntityId IN ('a011I00000D55nx') , This gives the result as url,
Anyone of them pleae let me know how to get the body of the file?
- Radha Rathinavel Pandian
- February 26, 2018
- Like
- 0
- Continue reading or reply
RECORD TYPE FIELD UPDATE
I have three record type C2B B2B D2B for contacts i have to update account amount filed with sum of contacts amount field WITH DIFFERENT RECORDTYPE
eg: 10,000(C2B AMOUNT)+10,000(D2B MOUNT )-10,000(B2B AMOUNT)=AMOUNT(ACCOUNT FILED)
- PRIYAN NEERUDU
- August 02, 2016
- Like
- 0
- Continue reading or reply
'columnrange' highchart in apex page
type: 'columnrange'
}
Other charts like bar, column can be easily rendered.
Here is the code:
<apex:page >
<head>
</head>
<body>
<apex:outputLink target="_Blank" value="/apex/test_portfolio" id="theLink" ><apex:image id="ITPR_EnlargeIcon" value="{!$Resource.ITPR_EnlargeIcon}" /></apex:outputLink>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="{!URLFOR($Resource.Highcharts)}"></script>
<script>
$(function () {
$('#container').highcharts({
chart: {
type: 'columnrange',
inverted: true
},
title: {
text: 'Temperature variation by month'
},
subtitle: {
text: 'Observed in Vik i Sogn, Norway, 2009'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
title: {
text: 'Temperature ( °C )'
}
},
tooltip: {
valueSuffix: '°C'
},
plotOptions: {
columnrange: {
dataLabels: {
enabled: true,
formatter: function () {
return this.y + '°C';
}
}
}
},
legend: {
enabled: false
},
series: [{
name: 'Temperatures',
data: [
[-9.7, 9.4],
[-8.7, 6.5],
[-3.5, 9.4],
[-1.4, 19.9],
[0.0, 22.6],
[2.9, 29.5],
[9.2, 30.7],
[7.3, 26.5],
[4.4, 18.0],
[-3.1, 11.4],
[-5.2, 10.4],
[-13.5, 9.8]
]
}]
});
});
</script>
</body>
</apex:page>
What could be the reason for this code to not work within the apex page? Is there any other suggestions on creating a column range chart?
Here is the link to the actual example in Highchart.
http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/columnrange/
I had originally posted this question to the Salesforce community and Deepak Anand had advised to look for JS errors.
I do see two same errors
Failed to load resource: the server responded with a status of 404 (Not Found) on a .png file. Not that I understand what the actual issue is.
- Alo Sen
- February 19, 2015
- Like
- 0
- Continue reading or reply
Contact address not displaying in visualforce page
I'm just starting to build my page, but I'm having some trouble getting a contact's address to display (other contact info displays fine).
I get the error "Unsupported type common.api.soap.wsdl.Address encountered"
Thanks,
<apex:page controller="ContractClass"> <apex:pageBlock title="Client Information"> <apex:pageblocksection columns="2"> <apex:outputText label = "Contact Name" value="{!Contact.FirstName} {!Contact.LastName}"/> <apex:outputText label = "License Company" value="{!Opportunity.Account.Name}"/> <apex:outputText label="Mailing Address" value="{!Contact.MailingAddress}"/> </apex:pageblocksection> </apex:pageBlock> </apex:page>
public class ContractClass {
Contact oppContact = new Contact();
Opportunity myOpp = new Opportunity();
String oppId;
String acctId;
public ContractClass() {
oppId = '006R0000008fsEY';
myOpp = [SELECT Id, Amount, Account.Name, Account.Id FROM Opportunity WHERE Id = :oppId LIMIT 1];
acctId = myOpp.Account.Id;
oppContact = [SELECT FirstName, LastName, MailingAddress FROM Contact WHERE accountId = :acctId LIMIT 1];
}
public Opportunity getOpportunity() {
return myOpp;
}
public Contact getContact() {
return oppContact;
}
}
- Mathew Andresen 5
- February 19, 2015
- Like
- 0
- Continue reading or reply
Trigger to auto populate lookup field on opportunity product lineitem
I hope someone can help me with this-
Auto populate a custom lookup field "Account_Name__C " on opportunity product lineitem with an "Account Name" from the opportunity object or possibliy from Account Object itself, needs to happen when a user selects the opportunity product and saves the record.
Please can someone advise?
Thanks,
Swapnil
- Swapnil Patne
- February 03, 2014
- Like
- 0
- Continue reading or reply
Trigger or workflow which will update the account name to be that of contacts
I was just wondering if someone could help me out with something. is it possible to make it so that, using a workflow rule or perhaps a trigger, the Account name is a combination of the contacts within the account. E.G. An account with ben and jane Samol would make the account name = Samol, Ben and Samol, Jane
- Developer.mikie.Apex.Student
- January 24, 2014
- Like
- 0
- Continue reading or reply
Custom Setting vs AJAX/Javascript
I have this following requirement.
I need to expose a button on a non-VF page.
Upon clicking the button, I need to check values from two fields (which are exposed in the page layout) say F1 and F2.
If the fields' value combination do exist from an approved list of combinations then I need to call TIBCO else I need to pop up an error message.
We cannot change the page , in which the button will be placed, as a VF page.
The fields F1 / F2 are hierarchial picklists.
Eg :
Say the approved List of combinations for F1,F2 are as follows {A,1} {A,2} {A,3}
F1 can have {A,B}
F2 can have {1,2,3,4,5}
Scenario #1 : User has chosen {A,1} and presses this custom button then TIBCO needs to be called
Scenario #2 : User has chosen {B,1} and presses this custom button then error message needs to be shown to the user.
(
***{B,1} is selectable while creating a record because it is supported in the hierarchial picklist combination. But for this ***specific*** functionality, the combination {B,1} is not supported
)
I thought of doing the below for this requirement
Approach #1 : Custom Object/AJAX/Javascript
a) Create a custom object that houses the valid list of combinations.
The custom object will have two custom fields F1,F2 containing only valid combinations.
b) Create a button in the page layout
c) When the user presses the button, use AJAX/Javascript to issue a SOQL SELECT to the custom object from step a).
c-1 : If I find a record from the custom object then call TIBCO
c-2 : If I dont find a record from the custom object then popup an error message
Approach #2 : Custom setting
My colleague has suggested me to try out with custom settings instead of the above route but I am not so sure about using that.
Also how different it would be from approach #1 even if I go with custom setting.
Can you guys provide your inputs ?.
Is approach #1 better or approach #2 better ?
Thanks in advance for your time !
Nurav
- Nurav1982
- December 31, 2014
- Like
- 0
- Continue reading or reply
Adding Custom console component as sidebar within subtabs
Hi
I have built custom console Component and included it in Case page layout. This Component opens up in sidebar as per expectation but only when Case is opened in primary tab, when we open the same in Subtab Console Component do not appear. As a result while Chat is being initiated opened Case as a subtab do not show that console Component.
Here I need to Show Custom Console Component within the Subtabs just like Suggested article.
Any help regarding this would be highly appreciated.
Thanks.
- Vikash Tiwary
- May 17, 2013
- Like
- 0
- Continue reading or reply
Unsubscribe Email Service - Need notification when From Address cannot be found
Hi all..I'm hoping someone can help me here. I have downloaded the 'Unsubscribe Opt Out' package from the AppExchange and it works great except for one part. I require an email notification to be sent to me if the email address the message is from is not found in Salesforce.
The clients my reps deal with have a high turnover rate so a mass mailing may be sent to an email of someone who has left that is just being forwarded to someone elses account. When they send the unsubscribe email back, that email address will not be in our system and we need to be notified of that.
Is there an easy way to implement this logic into the code pasted below? All I would require in the email message would be a simple message ' env.FromAddress can not be found within Salesforce.com'.
Thank you in advance!
Global class unsubscribe implements Messaging.inboundEmailHandler{ Global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope env ) { // Create an inboundEmailResult object for returning //the result of the Apex Email Service Messaging.InboundEmailResult result = new Messaging.InboundEmailResult(); // Contact and Lead lists to hold all the updated records List<Contact> lc = new List <contact>(); List<Lead> ll = new List <lead>(); // Convert the subject line to lower case, so I can match on lower case String mySubject = email.subject.toLowerCase(); // String I am searching for in the subject line String s = 'unsubscribe'; // Check variable to see if the word "unsubscribe" was found in the subject line Boolean unsubMe; // Look for the unsubcribe word in the subject line, // if it is found return true, otherwise false is returned unsubMe = mySubject.contains(s); // If unsubscribe is found in the subject line enter the if statement if (unsubMe == true) { try { // Lookup all contacts with a matching email address for (Contact c : [Select Id, Name, Email, HasOptedOutOfEmail From Contact Where Email = :env.fromAddress And hasOptedOutOfEmail = false Limit 100]) { // Add all the contacts into the List c.hasOptedOutOfEmail = true; lc.add(c); } // update all the Contact records update lc; } catch (System.QueryException e) { System.debug('Contact Query Issue: ' + e); } try { // Lookup all leads matching the email address for (Lead l : [Select Id, Name, Email, HasOptedOutOfEmail From Lead Where Email = :env.fromAddress And isConverted = false And hasOptedOutOfEmail = false Limit 100]) { // Add all the leads to the List l.hasOptedOutOfEmail = true; ll.add(l); System.debug('Lead Object: ' + l); } // Update all Lead records in the query update ll; } catch (System.QueryException e) { System.debug('Lead Query Issue: ' + e); } System.debug('Found the unsubscribe word in the subject line.'); } else { System.debug('No Unsuscribe word found in the subject line.' ); } // Return true and exit // True will confirm it is complete and no bounced email // should be send the sender of the unsubscribe request. result.success = true; return result; } // Test method to ensure you have enough code coverage // Have created two methods, one that does the testing // with a valid "unsubcribe" in the subject line // and one the does not contain "unsubscribe" in the // subject line static testMethod void testUnsubscribe() { // Create a new email and envelope object Messaging.InboundEmail email = new Messaging.InboundEmail() ; Messaging.InboundEnvelope env = new Messaging.InboundEnvelope(); // Create a new test Lead and insert it in the Test Method Lead l = new lead(firstName='Rasmus', lastName='Mencke', Company='Salesforce', Email='rmencke@salesforce.com', HasOptedOutOfEmail=false); insert l; // Create a new test Contact and insert it in the Test Method Contact c = new Contact(firstName='Rasmus', lastName='Mencke', Email='rmencke@salesforce.com', HasOptedOutOfEmail=false); insert c; // test with subject that matches the unsubscribe statement email.subject = 'test unsubscribe test'; env.fromAddress = 'rmencke@salesforce.com'; // call the class and test it with the data in the testMethod unsubscribe unsubscribeObj = new unsubscribe(); unsubscribeObj.handleInboundEmail(email, env ); } static testMethod void testUnsubscribe2() { // Create a new email and envelope object Messaging.InboundEmail email = new Messaging.InboundEmail(); Messaging.InboundEnvelope env = new Messaging.InboundEnvelope(); // Create a new test Lead and insert it in the Test Method Lead l = new lead(firstName='Rasmus', lastName='Mencke', Company='Salesforce', Email='rmencke@salesforce.com', HasOptedOutOfEmail=false); insert l; // Create a new test Contact and insert it in the Test Method Contact c = new Contact(firstName='Rasmus', lastName='Mencke', Email='rmencke@salesforce.com', HasOptedOutOfEmail=false); insert c; // Test with a subject that does Not contain unsubscribe email.subject = 'test'; env.fromAddress = 'rmencke@salesforce.com'; // call the class and test it with the data in the testMethod unsubscribe unsubscribeObj = new unsubscribe(); unsubscribeObj.handleInboundEmail(email, env ); } }
- Wiz76
- April 23, 2013
- Like
- 0
- Continue reading or reply
Problem with document.getElementbyID
Hi i am unable to get the selected radio button value into the javascript . I am getting as undefined .
i want the value when i am clicking another button in the same form.
<apex:page controller="sampleCon" sidebar="false" showHeader="false" id="testpage">
<script>
function checkThis(){
alert('hi');
var a=document.getElementById('{!$Component.theform.country}').value
alert(a);
}
</script>
<apex:form id="theform">
<apex:selectRadio value="{!country}" id="country" >
<apex:selectOptions value="{!items}"/>
</apex:selectRadio><p/>
<apex:commandButton value="Test" action="" onclick="checkThis();" rerender="out" status="status"/>
</apex:form>
</apex:page>
<apex:outputPanel id="out">
<apex:actionstatus id="status" startText="testing...">
<apex:facet name="stop">
<apex:outputPanel >
<p>You have selected:</p>
<apex:outputText value="{!country}"/>
</apex:outputPanel>
</apex:facet>
</apex:actionstatus>
</apex:outputPanel>
</apex:page>
=============================
Controller :
public class sampleCon {
String country = null;
public PageReference test() {
return null;
}
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico')); return options;
}
public String getCountry() {
return country;
}
public void setCountry(String country) { this.country = country; }
}
- Prakash@SFDC
- April 16, 2013
- Like
- 0
- Continue reading or reply
How to Find the apex class method is calling from Test class Urgent
Hi All,
I wish to find the Apexmethod is calling from Test class.
Ex:
Class A has the method called cal();
B is the test class for A and B is calling cal() Method of A.
So I wish to find the cal() is Calling from B(Test Class).
please help me ...
- @Siva.ax1713
- April 16, 2013
- Like
- 0
- Continue reading or reply
Exception handling
Hi,
We have a Batch class which is scheduled to run every day. This batch will update a specific user with role to a custom field on Oppty.
The problem is that we have a Validation rule on Oppty, because of which some Batches are failing.
I want to bypass this validation rule while the Batch job is running.
Is the below code snippet correct?
*************************************************************************************************************************************
try{
update opp; //This is the Oppty which we are updating
}
Catch(Exception e)
{
string sErrMsg=e.getmessage();
if(sErrMsg.contains('Opportunities can only be created for active Prospects/Customers.You are unable to create this opportunity because either your prospect has not been approved yet or Prospect/Customer record is inactive--which will require onboarding the Prospect/Customer.'))
return;
}
*************************************************************************************************************************************
will this piece of code bypass the validation rule and will this help the batches to run successfully?
- Taruni
- April 16, 2013
- Like
- 0
- Continue reading or reply
check whether the user log in first time or more in the same day
Hi
I am in need of creating splash screen when a user first login in a particular day . It need to be shown when he come again in a same page . But i tried to use session i am unable to find it.
Suggestions required as early as possible
Thanks in advance
- ekarthik
- February 22, 2013
- Like
- 0
- Continue reading or reply
Delete files older the 3 minutes
Hello all,
There is a way to delete files older than 3 minutes?
Thanks.
- ZurMiles
- February 19, 2013
- Like
- 0
- Continue reading or reply
Adding Custom buttons to related lists in salesforce
I am having two object. Eg: A & B two custom objects. These both are having master detail relation ship. A is Master object to B object. In the "A" object for the "B related list" i want to add custom button beside to the standard buttonss. Can any one help me on this ???
- kittu9
- February 19, 2013
- Like
- 0
- Continue reading or reply
Set default value for multiple fields (using controller extension)
Hi all,
I have an Apex page which only renders certain pageblock sections according to the user's selection.
In some cases, required fields will be hidden (per the below code snippet).
<apex:page standardController="opportunity" extensions="OppExt">
=== other code goes here == <apex:inputHidden value="{!opportunity.name}" id="name"/> <apex:inputHidden value="{!opportunity.Channel__c}" id="channel"/> <apex:inputHidden value="{!opportunity.closedate}" id="closedate"/> <apex:inputHidden value="{!opportunity.stagename}" id="stagename"/> <apex:inputHidden value="{!opportunity.probability}" id="probability"/>
== rest of my code goes here ==
</apex:page>
In order to be able to save the record, I need to ensure that required fields are populated with something in the background (ie a default value). So I do this via a controller extension.
However, the only success I've had is with setting a default value for the opportunity name. I've had no luck with the other fields.
public class OppExt { public OppExt(ApexPages.StandardController controller) {Opportunity opp = (Opportunity) controller.getRecord(); opp.name = 'Default value goes here';} }
Can anyone help me with assigning default values to the remaining hidden fields (channel, stagename, closedate, probability)?
- Chris
- dza84
- February 18, 2013
- Like
- 0
- Continue reading or reply
Dynamic Apex
Hi
I am retriving all sobjects in a pageblocktable by DynamicApex,but am not able to display all object names in pbtable column.iwant to display the object names in PBTable.
how,we can achieve this?
V.f:
<apex:page controller="allobjects_in_pbtable">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!objects}" var="a">
<apex:column />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Class:
public class allobjects_in_pbtable {
public list<Schema.SObjectType> getObjects() {
Map<String,Schema.SObjectType> gd=schema.getGlobalDescribe();
list<Schema.SObjectType> ss=gd.values();
return ss;
}
}
- Swamy P
- February 18, 2013
- Like
- 0
- Continue reading or reply
How to write get the first name and last name as a single Name into Name field?
Hi
I have 2 fields named firstname and lastname and I need to get them as a single name and to the name field.
Can anyone suggest a way for this?
- Mad Developer
- February 12, 2013
- Like
- 0
- Continue reading or reply
Mixed Charts with Jquery
Hi all contributors,
I wanted to share the following example with you all.
which shows how to show various types of graphs in the same chart.
Let me know in case of any concerns..!
- harsha__c
- January 22, 2013
- Like
- 0
- Continue reading or reply
How to change the display Name of Boards..?
Hi
Can any one suggest me how to change the display name from the discussion boards..!
For Example my Name is harsha, but by mistakeI typed hasha
So, I tried to change it, but I dint find any option for it..!
Can any one share a way for this....
Thanks in advance
- harsha__c
- December 03, 2012
- Like
- 0
- Continue reading or reply
How to create a custom button for a related list..?
Basically, my req is like this...
I have an object named COURSE__C and it's look-up is there in STUDENT_COURSE__C object. So obviously we will get a related list of STUDENT_COURSE__C over the detail page of COURSE__C.
So here i want to create a button named DELETE ALL in the related list, which enables me to delete all the look-ups of a perticular course...
If it can be done, can any one guide me towards it...........!
Thanks in advance...
- harsha__c
- June 22, 2012
- Like
- 0
- Continue reading or reply
Binding a variable between VF page and controller
Here is my Requirement
I given 'h' in the search field in VF page.
When i press the search button it should display the all Account Names starting with 'h' letter
In handler I have a variable of string type and is binded to the VF page.
Now my doubt is,
How to get the AccountNames starting with the letter stored in the string variable.....
Can anyone suggest me the way
- harsha__c
- May 23, 2012
- Like
- 0
- Continue reading or reply
How to find an object without parent object in apex ?
I am actually writing a code that helps to get automatically the dependencies between Object.
While writing my code, I faced an issue. I cannot find a way to know when an object doesn't have a parent object.
How can I find that in apex ?
- Ariane Gardou 3
- November 19, 2019
- Like
- 0
- Continue reading or reply
Is it possible to upload a package without any unit tests?
Is there a way around the unit test coverage requirement? Is there a better way to back up and restore my work around the Sandbox refresh?
- Zoe Hart
- November 19, 2019
- Like
- 0
- Continue reading or reply
error in my batch class
Hi, I wrote a batch class to send email notification to users from Queue.
This is my class:
global class sendEmailBatchClass implements Database.Batchable < sobject > { global Database.QueryLocator start(Database.BatchableContext bc) { Date dt = date.today().addDays(1); System.debug('scope ' + dt); return Database.getquerylocator([SELECT Id,OwnerId,Name,Owner.Email, (Select Id,OwnerId,Name,Owner.Email from SVMXC__Work_Orders__r where SIG_Due_Date__c =:dt and SVMXC__Order_Status__c NOT IN ('Closed','Completed')), (Select Id,OwnerId,Name,Owner.Email from Administrative_Tasks__r where SIG_Due_Date__c =:dt and SIG_Status__c Not IN ('Closed','Completed')) From SVMXC__Service_Request__c WHERE SVMXC__Status__c = 'Open' and SVMX_SIG_Due_Date__c =: dt]); } global void execute(Database.BatchableContext bc, List <SVMXC__Service_Request__c> scope) { System.debug('scope ' + scope); String userStringVal = '005'; List<SVMXC__Service_Order__c> emailUsers = new List<SVMXC__Service_Order__c>(); Map<Id,set<SVMXC__Service_Request__c>> srMap = new Map<Id, set<SVMXC__Service_Request__c>>(); System.debug('#####srMap ' + srMap); Map<Id, Set<SVMXC__Service_Order__c>> woMap = new Map<Id, Set<SVMXC__Service_order__c>>(); System.debug('#####woMap ' + woMap); Map<Id, Set<SIG_Administrative_Task__c>> atMap = new Map<Id, Set<SIG_Administrative_Task__c>>(); System.debug('#####atMap ' + atMap); Map<String, set<SVMXC__Service_Request__c>> userSRMap = new Map< String, set<SVMXC__Service_Request__c>>(); System.debug('#####userSRMap ' + userSRMap); Map<String, set<SVMXC__Service_Order__c>> userWoMap = new Map< String, set<SVMXC__Service_Order__c>>(); System.debug('#####userWoMap ' + userWoMap); Map<String, set<SIG_Administrative_Task__c>> userATMap = new Map< String, set<SIG_Administrative_Task__c>>(); System.debug('#####userATMap ' + userATMap); OrgWideEmailAddress[] owea = [select Id,DisplayName,Address from OrgWideEmailAddress where DisplayName = 'SIG OrgWideAddress']; For(SVMXC__Service_Request__c srVal:scope){ If(string.valueOf(srVal.OwnerId).startsWith(userStringVal)){ if(!userSRMap.containsKey(srVal.Owner.Email)){ userSRMap.put(srVal.Owner.Email,new set<SVMXC__Service_Request__c>{srVal} ); }else { userSRMap.get(srVal.Owner.Email).add(srVal); system.debug('**userSRMap'+userSRMap); } system.debug('**userSRMap'+userSRMap); } else{ if(!srMap.containsKey(srVal.OwnerId)){ srMap.put(srVal.OwnerId,new set<SVMXC__Service_Request__c>{srVal} ); }else { srMap.get(srVal.OwnerId).add(srVal); system.debug('***srMap'+srMap); } system.debug('**userSRMap'+userSRMap); } For(SVMXC__Service_Order__c woVal :srVal.SVMXC__Work_Orders__r){ If(string.valueOf(srVal.OwnerId).startsWith(userStringVal)){ if(!userWoMap.containsKey(woVal.Owner.Email)){ userWoMap.put(woVal.Owner.Email,new set<SVMXC__Service_Order__c>{woVal} ); }else { userWoMap.get(woVal.Owner.Email).add(woVal); } } else{ if(!woMap.containsKey(woVal.OwnerId)){ woMap.put(woVal.OwnerId,new set<SVMXC__Service_Order__c>{woVal} ); }else { woMap.get(woVal.OwnerId).add(woVal); } } } For(SIG_Administrative_Task__c atVal :srVal.Administrative_Tasks__r){ If(string.valueOf(atVal.OwnerId).startsWith(userStringVal)){ if(!userATMap.containsKey(atVal.Owner.Email)){ userATMap.put(atVal.Owner.Email,new set<SIG_Administrative_Task__c>{atVal} ); }else { userATMap.get(atVal.Owner.Email).add(atVal); } } else{ if(!atMap.containsKey(atVal.OwnerId)){ atMap.put(atVal.OwnerId,new set<SIG_Administrative_Task__c>{atVal} ); }else { atMap.get(atVal.OwnerId).add(atVal); } } } } /*** Group Member Extracting ***/ Set<Id> groupIds = new Set<Id>(); groupIds.addAll(srMap.keyset()); groupIds.addAll(woMap.keyset()); groupIds.addAll(atMap.keyset()); Map<Id,Set<user>> GpMap = new Map<Id,Set<User>>(); Map<Id,User> userVal = new Map<Id,User>([SELECT User.Id, User.Email FROM User WHERE Id IN (SELECT UserOrGroupId FROM GroupMember WHERE GroupId in : groupIds)]); For(GroupMember gm :[Select groupId, UserOrGroupId From GroupMember where groupId IN : groupIds]){ if(GpMap.containsKey(gm.groupId)){ GpMap.get(gm.groupId).add(userVal.get(gm.UserOrGroupId)); }else{ GpMap.put(gm.groupId,new set<User>{userVal.get(gm.UserOrGroupId)}); } } // Extracting group member from Service Request If(!GpMap.isEmpty() && !srMap.isEmpty()){ For(Id gVal : GpMap.keyset()){ For(User usVal : GpMap.get(gVal)){ if(!userSRMap.containsKey(usVal.Email)){ userSRMap.put(usVal.Email,new set<SVMXC__Service_Request__c>(srMap.get(gVal))); } else { userSRMap.get(usVal.Email).addAll(srMap.get(gVal)); } } } } // Extracting group member from Work Order If(!GpMap.isEmpty() && !woMap.isEmpty()){ For(Id gVal : GpMap.keyset()){ For(User usVal : GpMap.get(gVal)){ if(!userWoMap.containsKey(usVal.Email)){ userWoMap.put(usVal.Email,new set<SVMXC__Service_Order__c>(woMap.get(gVal))); } else { userWoMap.get(usVal.Email).addAll(woMap.get(gVal)); } } } } // Extracting group member from Service Request If(!GpMap.isEmpty() && !atMap.isEmpty()){ For(Id gVal : GpMap.keyset()){ For(User usVal : GpMap.get(gVal)){ if(!userSRMap.containsKey(usVal.Email)){ userATMap.put(usVal.Email,new set<SIG_Administrative_Task__c>(atMap.get(gVal))); } else { userATMap.get(usVal.Email).addAll(atMap.get(gVal)); } } } } // Sending Email for Service Request For(String userval1: userSRMap.keyset()){ For(SVMXC__Service_Request__c srlistval: userSRMap.get(userval1)){ Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); Id templateId = [select id, name from EmailTemplate where developername = 'SIG_Service_Request_Escalation_Email'].id; // Create Contact Contact con; con = new Contact(); con.FirstName = 'Test'; con.LastName = 'Contact'; con.Email = 'no-reply@organization.com'; insert con; email.setTargetObjectId(con.Id); // email.setTargetObjectId(srlistval.ownerId); String[] toAddresses ; // I have hardcoded my Id for testing , please update the logic to add the respective email addresses. toAddresses = new String[] {'vivek.agrawal@servicemax.com'}; email.setOrgWideEmailAddressId(owea[0].Id); email.setCcAddresses(toAddresses); email.setWhatId(srlistval.Id); email.setTemplateId(templateId); email.setSaveAsActivity(false); Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); system.debug('***email Message'+email); } } // Sending Email For Work Order For(String userval1: userWoMap.keyset()){ For(SVMXC__Service_Order__c woListVal: userWoMap.get(userval1)){ Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); Id templateId = [select id, name from EmailTemplate where developername = 'SIG_Work_Order_Escalation_Email'].id; //email.setTargetObjectId(woListVal.ownerId); // Create Contact Contact con; con = new Contact(); con.FirstName = 'Test'; con.LastName = 'Contact'; con.Email = 'no-reply@organization.com'; insert con; email.setTargetObjectId(con.Id); String[] toAddresses ; // I have hardcoded my Id for testing , please update the logic to add the respective email addresses. // toAddresses = new String[] {'vivek.agrawal@servicemax.com'}; toAddresses = new String [] {}; for (String emaill : emailUsers.SIG_Queue_Members_Email_Address__c.split(',')) { String trimmed = email.trim(); if (trimmed.length() > 0) { toAddresses.add(trimmed); } } email.setOrgWideEmailAddressId(owea[0].Id); email.setCcAddresses(toAddresses); email.setWhatId(woListVal.Id); email.setTemplateId(templateId); email.setSaveAsActivity(false); Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); } } // Sending Email For Admin Task For(String userval1: userATMap.keyset()){ For(SIG_Administrative_Task__c adListVal: userATMap.get(userval1)){ Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); Id templateId = [select id, name from EmailTemplate where developername = 'SIG_Service_Request_Escalation_Email'].id; // Create Contact Contact con; con = new Contact(); con.FirstName = 'Test'; con.LastName = 'Contact'; con.Email = 'no-reply@organization.com'; insert con; email.setTargetObjectId(con.Id); // email.setTargetObjectId(adListVal.ownerId); String[] toAddresses ; // I have hardcoded my Id for testing , please update the logic to add the respective email addresses. toAddresses = new String[] {'vivek.agrawal@servicemax.com'}; email.setOrgWideEmailAddressId(owea[0].Id); email.setCcAddresses(toAddresses); email.setWhatId(adListVal.Id); email.setTemplateId(templateId); email.setSaveAsActivity(false); Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); } } } global void finish(database.BatchableContext bc) { } }
I'm trying to loop through each user from the Queue but i'm not sure how to do it...Also I have this error, I think from here I can solve my problem
- Trif Cristian 7
- November 19, 2019
- Like
- 0
- Continue reading or reply
Dynamically add Picklist value
How can i add dynamically picklist value when i am uploading file using data loader (when value is not there from csv that will add as picklist value).Is there any work around....
- SFDC@Error
- November 19, 2019
- Like
- 0
- Continue reading or reply
Finding the SOQL query
how can I find out what the associated SOQL query is to a field in SFDC. For example if I want to know what the SOQL query for an account field named 'Account Name' is?
- Zaid Farooqi 7
- November 18, 2019
- Like
- 0
- Continue reading or reply
how to fetch my content of my document
I need to fetch my content of my document which is uplaoded to the attachment.
I need to pass the query in REST API through workbench
So far I tried , Select id,ContentDocumentId,ContentDocument.LatestPublishedVersionId from ContentDocumentLink where LinkedEntityId IN ('a011I00000D55nx') , This gives the result as url,
Anyone of them pleae let me know how to get the body of the file?
- Radha Rathinavel Pandian
- February 26, 2018
- Like
- 0
- Continue reading or reply
Need to Update User Look from text box in custom object
I need to be able to update another LOOKUP field (relationsjhip is the User table) based on the employee number the user enters.
The employee number is a field in the USER table ..so I need to match on it and return the userID to the empty lookup field
Can this be done with a workflow or process builder.
Example:
Text fied value Employee Number = 50410
Need to relate that value to the user.employeeID
and return the user.ID to a seperate lookup field
- Mark Neill 13
- February 24, 2018
- Like
- 0
- Continue reading or reply
LIMIT_EXCEEDED: System.LimitException: NSCRM:Too many queueable jobs added to the queue: 2
I have the above error when I setup a Data Mapping with Adobe Sign. The data mapping is trying to check a checkbox on Quote object, but the process builder that is causing the above error is not related to the checkbox on Quote.
Any idea why this error occurs? Any help would be greatly appreciated!!
Nav
- Navreet Atwal
- February 23, 2018
- Like
- 0
- Continue reading or reply
when click on button whole page will be redirecting using through apex page reference method
- sekhar maramreddy
- July 06, 2017
- Like
- 0
- Continue reading or reply
custom settings in sandbox
- md inayat
- June 29, 2017
- Like
- 0
- Continue reading or reply
tabOrder for checkbox field in visualforce page
I am facing a issue in the tadorderhint/tabindex of inputcheck/inputField ?
After 58 taborder disappears ?? ( these are checkbox fields )
Also tried inputcheck and taborder but no luck..
The Tab order does not appear on checkbox ( highlighted below)
Any ideas ??
<apex:pageBlockSection title="Required Prod" columns="1" >
<apex:pageBlockSection id="red5" title="Sales Turnover & Forecasts" columns="1" >
<apex:inputField Label="What was value of your total sales?" value="{!demo__c.Turnover__c}" taborderhint="56"/>
<apex:inputField Label="What is forecast for the next 12 months?" value="{!demo__c.Year_1_Turn_Over__c}" taborderhint="57"/> <apex:inputField Label="What is forecast for the next 12 To 24 months?" value="{!demo__c.Year_2_Turn_Over__c}" taborderhint="58"/>
</apex:pageblockSection>
<apex:pageBlockSection title="Required Prod1" columns="1" >
<apex:inputField value="{!demo__c.2_Credit__c}" taborderhint="59"/>
<apex:inputField value="{!demo__c.1_Credit__c}" taborderhint="60"/>
<apex:inputField value="{!demo__c.3_Credit__c}" taborderhint="61"/>
<apex:inputField value="{!demo__c.4_Credit__c}" taborderhint="62"/>
<apex:inputField value="{!demo__c.Option4__c}" taborderhint="63"/>
</apex:pageblockSection>
- Raghu Ramanujam
- June 29, 2017
- Like
- 0
- Continue reading or reply
Finding a previously established job run
A prior Admin in my org set up a job to delete records when a new import occurs in a custom object on a daily basis.
To explain, we use a custom object in our org called "Additional Related Contacts". It imports from our core banking system and attaches to our contacts object. It is supposed to delete the old and replace with the new. It appears to be not functioning and I have no idea where to even look for this job.
I've looked in scheduled Jobs, Apex Jobs, Background Jobs, Bulk data Load etc and nothing appears to be what I am looking for.
How would I go about uncovering this needle in the haystack.
Any ideas or suggestions are appreciated.
- Kimberly Wargo 1
- November 22, 2016
- Like
- 0
- Continue reading or reply
Error in Too many soql 101
How to overcome salesforce limitation System.LimitException: Too many SOQL queries: 101
List<MasterCopy__c> masterCopyList = new List<MasterCopy__c>([Select Name,DateUpdate__c, Opening_Balance__c, Closing_Balance__c, Master_Code__c, Master_Name__c from MasterCopy__c]); List<MasterCopy__c> upsertMasterList = new List<MasterCopy__c>(); MasterCopy__c masterCopyInsert; List<MasterTest__c> masterTestList = new List<MasterTest__c>([Select Date__c, Opening_Balance__c, Master_Code__c, Name, Closing_Balance__c from MasterTest__c]); if(trigger.isBefore && trigger.isInsert ){ for(MasterTest__c masterTest : trigger.new){ masterTest.EntryDate__c = masterTest.Date__c; masterTest.To_Date__c = masterTest.Date__c; masterTest.From_Date__c = masterTest.Date__c; masterTest.Closing_Balance__c = masterTest.Opening_Balance__c; } }
- Money Care 7
- August 04, 2016
- Like
- 0
- Continue reading or reply
Using Javascript to update dependent picklist value
Hi
I wrote a visualforce page and what I thought was a cool chunk of javascript which, when executed, copies values in the page from some inputfields to others (without updating the record—user can still save or cancel). It works fine except in the case of two fields which are a controller/dependent picklist pair. Boiled right down, the problem code is here:
document.getElementById(DestContPListID).value = document.getElementById(SourceContPListID).value; document.getElementById(DestDepdPListID).value = document.getElementById(SourceDepdPListID).value;
The first line populates the controller picklist correctly but despite the second line the dependent picklist does not gain a value (most of the time). The reason seems to be that after I set the Controller picklist value (eg Tea) the dependent picklist does not show the possible values (eg English Breakfast, Earl Grey, Oolong, etc) and even when the code attempts to set it to one of these allowed values the field remains blank.
Note, I have tried manually setting the Controller Picklist to the desired value first (ie Tea) and then the dependent displays the possible values. If I run the script afterwards, it works fine. I assume I need something like this:
document.getElementById(DestContPListID).value = document.getElementById(SourceContPListID).value; document.getElementById(SourceContPListID).systemMethodWhichKicksTheStandardControllerIntoActionToUpdateElementsOnPage;
...
Or may be not.
BTW, I am using "pure" javascript. Haven't venture into using the AJAX Toolkit yet but willing to try if it is the solution here.
Thanks for any help.
Regards
MellowRen
- MellowRen
- March 14, 2013
- Like
- 0
- Continue reading or reply
Developer Forums : Best Practice
That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.
Thanks #Copy_Steve Molis
- sfdcMonkey.com
- November 24, 2017
- Like
- 18
- Continue reading or reply
used yyyy as YYYY shows different year from 2014 to 2015
In the VF I used the date format as YYYY-MM-dd in the
<apex:outputText value="{0,date,YYYY/MM/dd}">
Before the last week of the year it was OK. When the new year falls in the last week of Decemeber comes the issue.
For example
2014:
S M T W Th F Sat
28 29 30 31 1 2 3
In the above calendar 1st Jan of 2015 falls in the Thurusday.So when I viewd the records of 28,29,30 of December 2014 It showed as
2015-12-28
2015-12-29
2015-12-30
2015-12-31
After that I came to know that
@"YYYY" is week-based calendar year.
@"yyyy" is ordinary calendar year.
http://realmacsoftware.com/blog/working-with-date-and-time
cheers
suresh
- suresh.csk
- January 07, 2015
- Like
- 18
- Continue reading or reply
Announcing New Salesforce Developers Discussion Forums
Today we’re excited to announce the new Salesforce Developers Discussion Forums. We’ve listened to your feedback on how we can improve the forums. With Chatter Answers, built on the Salesforce1 Platform, we were able to implement an entirely new experience, integrated with the rest of the Salesforce Developers site. By the way, it’s also mobile-friendly.
We’ve migrated all the existing data, including user accounts. You can use the same Salesforce account you’ve always used to login right away. You’ll also have a great new user profile page that will highlight your community activity. Kudos have been replaced by “liking” a post instead and you’ll now be able to filter solved vs unsolved posts.
This is, of course, only the beginning — and because it’s built on the Salesforce1 Platform, we’re going to be able to bring you more features faster than ever before. Be sure to share any feedback, ideas, or questions you have on this forum post.
Hats off to our development team who has been working tirelessly over the past few months to bring this new experience to our community. And thanks to each of you for helping to build one of the most vibrant and collaborative developer communities ever.
- Lauren Grau
- December 22, 2013
- Like
- 58
- Continue reading or reply
SOAPUI: Salesforce Integration Helper
Thouht to share this will you all if it helps in any way.
http://simplyforce.blogspot.in/2013/12/using-soapui-for-salesforce.html
- Bhawani Sharma
- December 02, 2013
- Like
- 9
- Continue reading or reply
Opportunities & Products
Hi!
I want to create a workflow using the Products section (located in the object "Opportunities").
(This is the section "Products").
I need to create a rule that, everytime I add a new product, an email is sent to X person.
But the problem here is that the fields in the product section does not appear when I try to create the rule. I believe that they are not regular fields.
Can anybody help me with this?
Thanks in advance!
- SebaLS
- January 29, 2013
- Like
- 1
- Continue reading or reply
Regarding Unit Test classes
Hi,
I am new apex and visualforce. I have simple question. Why we write "static" keyword for test methods.
Thanks in advance.
- code developer
- January 29, 2013
- Like
- 1
- Continue reading or reply