- Anil Savaliya
- NEWBIE
- 248 Points
- Member since 2013
- Salesforce Developer
- WellsFargo & Comapany.
-
ChatterFeed
-
7Best Answers
-
0Likes Received
-
2Likes Given
-
10Questions
-
70Replies
Not able to see future method logs
I am not able to see future method logs in production server where as I can see thos elogs on my sandbox account ?
Can anyone please help me, How can I enable future method logs in production server ?
Note : However I can see application logs in my production salesforce.
Thank,
Abhishek
- Abhishek Kedari
- November 20, 2014
- Like
- 0
- Continue reading or reply
- Nehaa
- April 30, 2014
- Like
- 0
- Continue reading or reply
Getting a Save error: Expression cannot be assigned on my code and not sure why?
trigger AssignTerritoryType on Account (before insert, before update) {
For (Account a :trigger.new){
Set<string> majorIndustries = new Set<string>{'Pharma/BioTech', 'Energy', 'Fed - Gov' ,'State - Mid','Education'};
if ( (a.NumberOfEmployees >= 10000) ||
(a.AnnualRevenue >= 500000000) ||
(a.Fortune_500__c = true) ||
( (a.Fortune_500_1000__c = True) && (a.NumberOfEmployees >=10000) && (a.AnnualRevenue >= 500000000) ) || //note that even if a.Fortune_500_1000__c = False it'll fall if a.NumberOfEmplyees >=10000 is true or A.AnnualRevenue>=500000000 since it will meet a previous condidtion
majorIndustries.contains(a.Industry) = 'Pharma/BioTech')
{
a.Major__c=true;
}
if ( ((a.NumberOfEmployees < 10000) && (a.NumberOfEmployees >=4000)) ||
((a.AnnualRevenue > 500000000) && (a.AnnualRevenue <=250000000)) ||
((a.Fortune_501_1000__c = true) &&(a.NumberOfEmployees > 10000) && (a.AnnualRevenue > 500000000))||
(majorIndustries.contains(a.Industry) = 'State - mid')||
((a.NumberOfEmployees >=8000) && (majorIndustries.contains(a.Industry) = 'Education')
)
)
{
a.Mid__c=true;
}
if ((a.NumberOfEmployees < 4000) && (a.NumberOfEmployees >=1500)
)
{
a.Inside__c=true;
}
If ((a.NumberOfEmployees < 4000)
)
{
a.Inside_small__c=true;
}
}
}
- Travis Wright
- April 29, 2014
- Like
- 0
- Continue reading or reply
Selecting records where a datetime value meets criteria
Hi there,
I have a querry in my apex trigger that looks like this:
List<DatedConversionRate> ExchRateCache = [SELECT ISOCode, ConversionRate, StartDate, NextStartDate FROM DatedConversionRate where ISOCode in :CurrCodes ];
This works fine, but it pulls the currency exchange rate of all time, and I only want the exchange rate on the 1st day of the month. I then changed it as below.
List<DatedConversionRate> ExchRateCache = [SELECT ISOCode, ConversionRate, StartDate, NextStartDate FROM DatedConversionRate where ISOCode in :CurrCodes AND ExchRateCache.StartDate.Day()='1'];
But I got an error saying "unexpected token: ')' at line 70 column 192"
Can some one be so kind and give me some instruction? Very much appreciate!
Alice
- Alice Ju
- November 22, 2013
- Like
- 0
- Continue reading or reply
Formula Field Not Populating
Greetings,
I have a custom controller and visualforce page. Long story short, one of the fields I am querying is a formula field that I would like to display on the visualforce page. No values are displayed. Any thoughts on how I can get the formula field to populate the value?
Here is the method from my controller:
"team_number__c" is the formula field that will not populate on the visualforce page.
public list<MyCarrier> getCarriers(){
string sortFullExp = sortfield + ' ' + sortDirection;
carriers.clear();
for(carrier__c c : database.query('select team_number__c, insurance_requested__c, load_date_time__c, date_submitted__c, lastmodifiedby.alias, id, team__c, references__c, requester__c, fraud_websites__c, Insurance_received__c, conditional_letter__c, contract__c, MC_Number__c, compliance_action__c, attachment__c, name from carrier__c where team__c != NULL order by ' + sortFullExp ))
{
carriers.add(new myCarrier(c));
}
return carriers;
}
This is the formula that populates "team_number__c":::
if(Team__c = "t9chop1", "Team 9", if(Team__c = "t1chop2", "Team 1",""))
- SFDC-NOOB
- November 22, 2013
- Like
- 0
- Continue reading or reply
How to update a field on a custom object using javascript in a custom button
Hi,
We have a custom button on a custom object. We click on this button and the javascript performs the actions based on a field in this custom object. The field is a checkbox field and it has default value as unchecked. Like this -
-----------------------------------
If field A = 0 (unchecked)
perform AAA
else
perform BBB
-----------------------------------
But we want to update the field value (checkbox should become checked) when if statement encounters the value = 0
-----------------------------------
If field A = 0 (unchecked)
update A = 1
perform AAA
else
perform BBB
-----------------------------------
How can we achieve this?
Thanks in advance!
Best regards
- Roboti
- November 20, 2013
- Like
- 0
- Continue reading or reply
scenario with admin part related
hi friends
pls help me with this simple scenario
I have 200 users ,in that i want to restrict "user 1" to view ,edit, or delete oppurtunity standard object only...how do i do this ..?
thanks
- priya bhawna shetty
- November 04, 2013
- Like
- 0
- Continue reading or reply
Json Response to Csv conversation
I am implementing API with our system,After Rest API call i getting JSON response,Please see in example for json response,i need to convert JSON string in CSV file and need export csv, How can i implement ? Any Idea ? sample code ?
Response :
[
{
"Revenue": "$1,000,000",
"Employees": "12345",
"MarketCap": "$1,000,000",
"Website": "www.yahoo.com",
"WebsiteURL": "http://www.yahoo.com",
"Industry": "Information Technology",
"LongDescription": "Long text",
"Description": "Discripting here",
"NodeID": "Org|345222",
"DisplayName": "Yahoo News"
},
{
"Revenue": "$2,000,000",
"Employees": "345435",
"MarketCap": "$1,02300,000",
"Website": "www.google.com",
"WebsiteURL": "http://www.google.com",
"Industry": "Information Technology",
"LongDescription": "Long text",
"Description": "Discripting here",
"NodeID": "Org|5323232",
"DisplayName": "Google Search"
},
{
"Revenue": "$5000,000,000",
"Employees": "500000",
"MarketCap": "$2,000,0000000",
"Website": "www.apple.com",
"WebsiteURL": "http://www.apple.com",
"Industry": "Telecommunication",
"LongDescription": "Long text",
"Description": "Discripting here",
"NodeID": "Org|534534",
"DisplayName": "Apple News"
}
]
- Anil Savaliya
- April 01, 2015
- Like
- 0
- Continue reading or reply
CSS is not working,When Visualforce page render as a PDF
I am trying to creat visualforce page,and it's render as a PDF,But CSS is working only when i write inline style, But It's not working when i write different in class,
For expriment You can take w3 school sample code :
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_layout_divs and page render as PDF
Any comment ? Any Idea ? Any suggestion ?
- Anil Savaliya
- December 11, 2014
- Like
- 0
- Continue reading or reply
Trigger is not Firing
I have contact Followed Object ,and It has master detail retailionship with contact and look up with user.
When I am deleteing contact ,it's delete contact follow by.it's natural and expected.But when I see debug log there is DML opetion happening for Delete Contact ,But I can't see DML opertion for Delete Contact Follow,But it's deleting contact follow by.Becuase of absent of DML opertion in contact follow,My trigger is not firring for contact follow by ?
This behaviour is natural or weired ?
- Anil Savaliya
- May 06, 2014
- Like
- 0
- Continue reading or reply
How get value from JSON string and insert ?
I getting response in JSON body like
String JS = '[{"User": "12345","Statuses": [{ "EntityId": 123, "Status": "Success" },{ "EntityId": 456, "Status": "Fail" }]},{"User": "67891","Statuses": [{ "EntityId": 345, "Status": "InvalidEntity" },{ "EntityId": 456, "Status": "Success" },{ "EntityId": 456, "Status": "Fail" }]}]';
and I have custom object exception_c and it's two custom field ExceptionUser__c and ExceptionEntityId__c
How can i write logic for exception record insert in case only status fail ?
If status fail insert exception record associate user and entityId assosiate with failer responce?
- Anil Savaliya
- March 31, 2014
- Like
- 0
- Continue reading or reply
get value from JSON string
String JS = '[{EntityID:3140001, User: "ABC@test.com"},{EntityID:4902138, User: "ABC@test.com"},{EntityID:43962599, User: "ABC@test.com"},{EntityID:46326732, User: "ABC@test.com"},{EntityID:50678752, User: "ABC@test.com"},{EntityID:3471919, User: "ABC@test.com"},{EntityID:3529201, User: "ABC@test.com"},{EntityID:3145503, User: "ABC@test.com"},{EntityID:478345, User: "ABC@test.com"},{EntityID:3599697, User: "ABC@test.com"},{EntityID:459246, User: "ABC@test.com"},{EntityID:49732437, User: "ABC@test.com"},{EntityID:3858674, User: "ABC@test.com"},{EntityID:459246, User: "ABC@test.com"},{EntityID:478345, User: "ABC@test.com"},{EntityID:3227994, User: "ABC@test.com"},{EntityID:3227994, User: "ABC@test.com"},{EntityID:124412, User: "ABC@test.com"},{EntityID:3140001, User: "xyz@test.com"},{EntityID:4902138, User: "xyz@test.com"},{EntityID:43962599, User: "xyz@test.com"},{EntityID:46326732, User: "xyz@test.com"},{EntityID:50678752, User: "xyz@test.com"},{EntityID:3471919, User: "xyz@test.com"},{EntityID:3529201, User: "xyz@test.com"},{EntityID:3145503, User: "xyz@test.com"},{EntityID:478345, User: "xyz@test.com"},{EntityID:3599697, User: "xyz@test.com"},{EntityID:459246, User: "xyz@test.com"},{EntityID:49732437, User: "xyz@test.com"},{EntityID:3858674, User: "xyz@test.com"},{EntityID:459246, User: "xyz@test.com"},{EntityID:478345, User: "xyz@test.com"},{EntityID:3227994, User: "xyz@test.com"},{EntityID:3227994, User: "xyz@test.com"},{EntityID:124412, User: "xyz@test.com"}][{EntityID:3140001, User: "ABC@test.com"},{EntityID:4902138, User: "ABC@test.com"},{EntityID:43962599, User: "ABC@test.com"},{EntityID:46326732, User: "ABC@test.com"},{EntityID:50678752, User: "ABC@test.com"},{EntityID:3471919, User: "ABC@test.com"},{EntityID:3529201, User: "ABC@test.com"},{EntityID:3145503, User: "ABC@test.com"},{EntityID:478345, User: "ABC@test.com"},{EntityID:3599697, User: "ABC@test.com"},{EntityID:459246, User: "ABC@test.com"},{EntityID:49732437, User: "ABC@test.com"},{EntityID:3858674, User: "ABC@test.com"},{EntityID:459246, User: "ABC@test.com"},{EntityID:478345, User: "ABC@test.com"},{EntityID:3227994, User: "ABC@test.com"},{EntityID:3227994, User: "ABC@test.com"},{EntityID:124412, User: "ABC@test.com"},{EntityID:3140001, User: "xyz@test.com"},{EntityID:4902138, User: "xyz@test.com"},{EntityID:43962599, User: "xyz@test.com"},{EntityID:46326732, User: "xyz@test.com"},{EntityID:50678752, User: "xyz@test.com"},{EntityID:3471919, User: "xyz@test.com"},{EntityID:3529201, User: "xyz@test.com"},{EntityID:3145503, User: "xyz@test.com"},{EntityID:478345, User: "xyz@test.com"},{EntityID:3599697, User: "xyz@test.com"},{EntityID:459246, User: "xyz@test.com"},{EntityID:49732437, User: "xyz@test.com"},{EntityID:3858674, User: "xyz@test.com"},{EntityID:459246, User: "xyz@test.com"},{EntityID:478345, User: "xyz@test.com"},{EntityID:3227994, User: "xyz@test.com"},{EntityID:3227994, User: "xyz@test.com"},{EntityID:124412, User: "xyz@test.com"}]';
I need get value between each {.......},How can i get ? I try use
string subject = JS;
Pattern p = Pattern.compile('\\{(.+?)\\}');
Matcher m = p.matcher(subject);
,But it's not work
How could get value like
Index 1 = EntityID:3140001, User: "ABC@test.com"
Index 2 = EntityID:4902138, User: "ABC@test.com"
----------------------------------------------------------
--------------------------------------------------------
Index 40 (Last any number) = EntityID:124412, User: xyz@test.com (mailto:xyz@test.com)
- Anil Savaliya
- March 19, 2014
- Like
- 0
- Continue reading or reply
How to Create Batch Apex,I am new in Batch Apex coding?
Calling from Trigger Below method:
/*********************Trigger**************************/
trigger contactFollow_checkEntitySubscription on Contacts_Followed_By__c(after insert, after delete, after update) {
if(Trigger.isInsert || Trigger.isUpdate){
for(Contacts_Followed_By__c contactFollow: Trigger.new){
contactFollowIdSet.add(contactFollow.Id);
}
--------------------------
------
AddAndDeleteRelSciController.RecordToGetAddRelSci(contactFollowIdSet);
}
/***********Class *********/
Public Class AddAndDeleteRelSciController{
Public static String JSONstring;
Public static Map<String, List<String>> userContactFollowMap = new Map<String, List<String>>();
Public Static void RecordToGetAddRelSci(Set<Id> contactFollowersIdSet){
//query all the user fields from the contactFollowersIdSet
List<Contacts_Followed_By__c> conFollowsList = [Select Id, User__c, User__r.Name, User__r.FederationIdentifier, Contact__c, Contact__r.rels__EntityId__c
FROM Contacts_Followed_By__c WHERE Id IN :contactFollowersIdSet];
for(Contacts_Followed_By__c conFollower : conFollowsList)
{
List<String> entityIdLIst = new List<String>();
if(userContactFollowMap.containsKey(conFollower.User__R.FederationIdentifier))
{
entityIdLIst = userContactFollowMap.get(conFollower.User__R.FederationIdentifier);
}
entityIdLIst.add(conFollower.Contact__r.rels__EntityId__c);
userContactFollowMap.put(conFollower.User__R.FederationIdentifier, entityIdLIst);
System.debug('*************** ' +userContactFollowMap);
AddRelSci(conFollower.User__R.FederationIdentifier, entityIdLIst);
}
}
@Future (callout=True)
Public Static void AddRelSci(String UsrName,List<String> Cntc){
Try{ System.debug('*****Final Test****'+UsrName+'---'+ Cntc) ;
If(UsrName != Null & !Cntc.isEmpty() ){
integer i;
String endpointUrl = Relationship_API_Setting__c.getValues('RelSciAPI').Add_Method_EndPointUrl__c;
String username = Relationship_API_Setting__c.getValues('RelSciAPI').UserName__c;
String password = Relationship_API_Setting__c.getValues('RelSciAPI').Password__c;
HttpRequest req = new HttpRequest();
req.setMethod('POST');
req.setHeader('Username', Username);
req.setHeader('password', password);
req.setHeader('UserIdentifier',UsrName);
req.setHeader('Content-Type', 'application/json');
req.setHeader('Accept','application/json');
req.setEndpoint(endpointUrl);
String JS = '[{EntityId: ';
integer S ;
for(S=0;Cntc.size()>S;S++){
JS = JS+''+Cntc[S]+'},{EntityId: ';
}
JSONstring = JS.SubString(0,JS.length()-12)+']';
System.debug('*******Add JSON String*******'+JSONstring);
req.setBody(JS);
If(Relationship_API_Setting__c.getValues('RelSciAPI').RelSci_API_is_Available__c){
Http http = new Http();
HttpResponse resp = http.send(req);
system.debug('*******Add Status Response*******'+resp.getStatus());
system.debug('*******Add Body Response*******'+resp.getBody());
If(resp.getStatus() != 'OK'){
Exception__c ex= new Exception__c();
ex.Erro_occur_for_user__c = UsrName ;
ex.Error_Occured_for_EntityID__c = JSONstring;
ex.Error_Code__c = string.valueof(resp.getStatusCode());
ex.Error_Status__c = resp.getStatus();
ex.Error_Message__c = resp.getBody();
ex.Error_Module__c = 'Relationship Science';
ex.Error_Generated_From_Method__c = 'ADD';
insert ex;
}
}
Else{
Exception__c ex= new Exception__c();
ex.Erro_occur_for_user__c = UsrName ;
ex.Error_Occured_for_EntityID__c = JSONstring;
ex.Error_Code__c = '001';
ex.Error_Status__c = 'RelSci API is Down';
ex.Error_Message__c = 'RelSci API is Down';
ex.Error_Module__c = 'Relationship Science';
ex.Error_Generated_From_Method__c = 'ADD';
insert ex;
}
}
}
Catch (Exception E)
{
Exception__c ex= new Exception__c();
ex.Erro_occur_for_user__c = UsrName ;
ex.Error_Occured_for_EntityID__c = JSONstring;
ex.Error_Code__c = '000';
ex.Error_Status__c = 'Unexpected Exception';
ex.Error_Message__c = E.getMessage();
ex.Error_Module__c = 'Relationship Science';
ex.Error_Generated_From_Method__c = 'ADD';
insert ex;
}
}
}
How can method from trigger in form batch,So i can't hit limit 10 call out ?
- Anil Savaliya
- March 04, 2014
- Like
- 0
- Continue reading or reply
Create Clone button on Custom visualforce for Custom Object which assiged to Tab
I have custom object Target.we are created custom visualforce page and assigned to Target Tab.We used custom visualfoce for targert because we have lot of validation during record save and page layout implemention according to product selected.
Example : Assiged Visaulforce CreateTarget to target tab (/apex/CreateTarget).Now business want to create clone button on created visualforcepage (CreateTarget).Is there any API for Clone or Idea?
Please help on create custom clone button on visualforce page?
- Anil Savaliya
- January 28, 2014
- Like
- 0
- Continue reading or reply
Create Clone button on Custom visualforce for Custom Object which assiged to Tab
I have custom object Target.we are created custom visualforce page and assigned to Target Tab.We used custom visualfoce for targert because we have lot of validation during record save and page layout implemention according to product selected.
Example : Assiged Visaulforce CreateTarget to target tab (/apex/CreateTarget).Now business want to create clone button on created visualforcepage (CreateTarget).Is there any API for Clone or Idea?
Please help on create custom clone button on visualforce page?
- Anil Savaliya
- January 28, 2014
- Like
- 0
- Continue reading or reply
Remaing white space when visaulforce page making renderded false in account section
Hi,
I created section in account calls 'RelSci',and assiged visualforce page on that section,Rendering section only who has permission to use 'RelSci' function.When Visualforce page make rendered = 'False',In account view,RelSci visualforce page disapper but leaving white space,Any idea to remove white space?
- Anil Savaliya
- October 29, 2013
- Like
- 0
- Continue reading or reply
Salesforce Architech - Charllote,NC
Hello,
We are looking saleforce Architech in out team.It is full time position in charllote,NC.No corp - Corp or third parties Please .send resume to beanil.savalia@gmail.com .
- Anil Savaliya
- August 19, 2013
- Like
- 0
- Continue reading or reply
REQUIRESCRIPT no longer working with Winter 16
As per release winter 16 release notes: http://releasenotes.docs.salesforce.com/en-us/winter16/release-notes/salesforce_release_notes.htm
REQUIRESCRIPT no longer executes JavaScript on Page Load.
We use the REQUIRESCRIPT function in several custom buttons on our lead page. When the Winter 16 features were released into our sandbox, our buttons started returning an error Reference $ Undefined.
I reached out to salesforce support, and they told me to use the code in the following article which removed the REQUIRESCRIPT function and instead, creates a custom java function.
https://help.salesforce.com/apex/HTViewSolution?urlname=Receiving-error-sforce-apex-is-null-or-not-an-object-1327108329858&language=en_US
I've been messing with the code above to fit it into my button. I'm stepping through the code through alerts, it stepped all the way through but at the end I get an Object error. Any help would be appreciated.
function loadScript(url)
{
var request;
if (window.XMLHttpRequest)
{
request = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
request = new ActiveXObject("Msxml2.XMLHTTP");
if (!request)
{
request = new ActiveXObject("Microsoft.XMLHTTP");
}
}
var se = document.createElement('script');
se.type = "text/javascript";
//alert("before Request undefined\n");
request.open("GET", url, false);
request.send(null);
se.text = request.responseText;
document.getElementsByTagName('head')[0].appendChild(se);
//alert("end of loadScript\n");
}
loadScript("/soap/ajax/30.0/connection.js");
loadScript("/soap/ajax/30.0/apex.js");
loadScript("/resource/jQuery/jquery-1.8.2.min.js");
loadScript("/resource/jQuery/ui/jquery-ui-1.9.1.custom.min.js");
loadScript("/resource/jQuery/postmessage/jquery.ba-postmessage.js");
loadScript("/resource/jQuery/bbq/jquery.ba-bbq.min.js");
loadScript("/resource/buttonjs");
try
{
var j$ = jQuery.noConflict();
var newurl= sforce.apex.execute("RegisterMerchant", "getPricingArticleID",{leadID : "{!Lead.Id}"});
newurl1 = String(newurl);
alert('Lead ArticleID '+newurl1);
if(newurl1.indexOf('error')>-1 )
{
alert(newurl);
document.location.reload(true);
}
else
{
alert('Start of Else Statement')
var strQuery="Select l.of_Pin_Pads__c,l.Id, l.Article_ID__c, l.Processing_Origin__c, l.Company, l.Strategic__c, l.Gift_Only__c, l.Dealer__r.Name, l.Developer__c, l.DLR_Sales__c, l.Name, l.OwnerId from Lead l where Id= '" +'{!Lead.Id}'+"'";
var accFields = sforce.connection.query(strQuery);
var records = accFields.getArray("records");
var owner = records[0].OwnerId;
var ContactName = records[0].Name;
var leadId = records[0].ID;
var Dealer = records[0].Dealer__r.Name;
var devID = records[0].Developer__c;
var Developer = null;
var DealerSalesperson = null;
if (devID!=null)
alert('Developer Record')
{
var strQuery3 = "SELECT Name from Account where ID='" +devID+"'";
var devField = sforce.connection.query(strQuery3);
var devRecord = devField.getArray("records");
Developer = devRecord[0].Name;
}
var ds = records[0].DLR_Sales__c;
//if (ds!= null)
alert('DLR sales Record1')
//{
var strQuery6 = "Select Name from Contact where id = '" +ds+"'";
var dlrSalesField = sforce.connection.query(strQuery6);
var dlrSalesRecord = dlrSalesField.getArray("records");
DealerSalesperson = dlrSalesRecord[0].Name;
//}
alert('Dlr sales Record2')
var NumberOfPinpads = 0;
//if(records[0].of_Pin_Pads__c!=null)
//{
NumberOfPinpads = parseInt(records[0].of_Pin_Pads__c);
//}
alert('Pin Pads')
var ArticleId = records[0].Article_ID__c;
var ProcessingOrigin = records[0].Processing_Origin__c;
var CompanyName = records[0].Company;
var StrategicAccount= records[0].Strategic__c;
var GiftOnly = records[0].Gift_Only__c;
alert('Other stuff')
// if diff is null, continue, if user clicked cancel, allow them to chg processing origin
console.log('leadId '+leadId+'--'+Dealer+'--'+Developer+'--'+ArticleId+'--'+DealerSalesperson);
// next section stolen from Josh, thanks for doing my typing buddy!
var $articleId = $('<input>', { name: 'ArticleId', type: 'hidden', value: ArticleId });
var $processingOrigin = $('<input>', { name: 'ProcessingOrigin', type: 'hidden', value: ProcessingOrigin });
var $companyName = $('<input>', { name: 'CompanyName', type: 'hidden', value: CompanyName });
var $strategicAccount = $('<input>', { name: 'StrategicAccount', type: 'hidden', value: StrategicAccount });
var $giftOnly = $('<input>', { name: 'GiftOnly', type: 'hidden', value: GiftOnly });
var $contactName = $('<input>', { name: 'ContactName', type: 'hidden', value: ContactName });
var $dealer = $('<input>', { name: 'Dealer', type: 'hidden', value: Dealer });
var $developer = $('<input>', { name: 'Developer', type: 'hidden', value: Developer });
var $dealerSalesperson = $('<input>', { name: 'DealerSalesperson', type: 'hidden', value: DealerSalesperson });
var $numberOfPinpads = $('<input>', { name: 'NumberOfPinpads', type: 'hidden', value: NumberOfPinpads });
//alert($articleId.html());
var $form = $('<form>', {
'action': '{!$Label.pricingUI}Invoke',
'method': 'post',
'target':'_blank'
});
$form.append($articleId);
$form.append($processingOrigin);
$form.append($companyName);
$form.append($strategicAccount);
$form.append($giftOnly);
$form.append($contactName);
$form.append($dealer);
$form.append($developer);
$form.append($dealerSalesperson);
$form.append($numberOfPinpads);
$(document.body).append($form);
$form.submit();
// alert('done by me');
}
}
catch(er)
{
alert(er);
}
- Ekin Van Winkle 2
- September 21, 2015
- Like
- 0
- Continue reading or reply
workaround for javascript in custom home page link
i have a requirement where, some statndards components needed to be hidden. With winter 16 release this is not working as expected.
Does anyone have a workaround for this??
- Apoorva Sharma
- September 15, 2015
- Like
- 0
- Continue reading or reply
Need help with getting a query out of a Loop
trigger AcceptJobAndCreateEmployee on Candidate_Application__c (after update) {
//This will be the list to add the new candidate
List<Account> accounts = new List<Account>();
//Query for the Account Record Types
List<RecordType> rtypes = [Select name, id FROM RecordType WHERE sObjectType = 'Account' AND IsPersonType = True];
Map<String,String> accountRecordTypes = new Map<String,String>();
for(RecordType rt: rtypes){
accountRecordTypes.put(rt.Name,rt.id);
}
for(Candidate_Application__c thisApplication: Trigger.new)
{
Candidate_Application__c oldApp = Trigger.oldMap.get(thisApplication.id);
Boolean AppFalse = oldapp.Job_Accepted__c;
Boolean AppTrue = thisApplication.Job_Accepted__c;
List <Candidate__c> newCandidates = [Select id, name FROM Candidate__C WHERE id =: thisApplication.Candidate__c];
if(!AppFalse && AppTrue)
{
if(newCandidates.size() > 0){
Account converted = new Account();
converted.RecordTypeid = accountRecordTypes.get('Person Account');
converted.LastName = newCandidates.get(0).Name;
converted.Phone = newCandidates.get(0).Phone__c;
accounts.add(converted);
}
}
}
insert accounts;
}
- Swaggy B
- March 05, 2015
- Like
- 0
- Continue reading or reply
Website Data - Salesforce Integration work required
We have an ecommerce site in php that builds some text string which is emailed to a custom email address in salesforce crm. We need to make some changes in salesforce to exsiting customisation, so are looking for a certified salesforce expert. Please see an example of the information we are sending
title:Mrs<eol>
first_name:Example<eol>
last_name:Example<eol>
homeno:0Example<eol>
mobile:<eol>
email:Example@me.com<eol>
dob:1970-08-16<eol>
address1:My Address <eol>
address2:Example<eol>
town:Bury<eol>
county:Greater Manchester<eol>
post_code:EX1 4PL<eol>
reg_no:Example<eol>
make:Hyundai<eol>
model:i30<eol>
specification:Premium<eol>
style:Hatchback<eol>
engine_cc:1600<eol>
fuel_type:Diesel<eol>
transmission:Manual<eol>
financed:No<eol>
vehicle_purchase_date:2014-93-19<eol>
purchase_value:16000.00<eol>
first_registered_date:2013-09-10<eol>
current_mileage:8843<eol>
gap_policy_type:Vehicle Replacement Insurance<eol>
gap_term:5 Years<eol>
gap_claim_limit:£15000<eol>
gap_price:250<eol>
tyre_policy_type:<eol>
tyre_term:<eol>
tyre_claim_limit:<eol>
tyre_price:<eol>
warranties_policy_type:<eol>
warranties_term:<eol>
warranties_claim_limit:<eol>
warranties_price:<eol>
mot_policy_type:<eol>
mot_term:<eol>
mot_claim_limit:<eol>
mot_price:<eol>
smart_policy_type:<eol>
smart_term:<eol>
smart_claim_limit:<eol>
smart_price:<eol>
I believe we are using a email service and a logic to read it.
We are looking to include a number of extra fields and also set up SF to automatically send an email template to the contact on creation of the account.
Long term, we will be working on a number of similar projects so would like to work with a Salesforce approved/credited company.
Please contact us if you would like more information and to provide a quotation.
- elaine@click2protect.co.uk
- January 16, 2015
- Like
- 0
- Continue reading or reply
Looking For Small Project Developer
* Call an external URL when certain salesforce objects (household,contact,activity) are insert/update/deleted
* Ease the registration for calling into the salesforce API (such as using remote site settings when installing AppExchange packages)
and implement it.
- Mark Fox
- January 16, 2015
- Like
- 0
- Continue reading or reply
SOQL: How to bulkify querying for 10,000 individual records
I'm trying to strategize how best to run this series of SOQL queries without triggering the limits. I have a csv of approximately 10,000 records. The goal is to check for each record whether there is a contact.owner.name associated with it. For instance (not complete, of course):
For(integer i:[csv file]){
SELECT Contact.Owner.Name. Contact.Custom_Field__c FROM Contact WHERE Contact.Custom_Field__c = csvFile[i]
}
How would you recommend I grab the data for all 10,000 records?
Thank you so much for your time and consideration of my inquiry.
With gratitude,
Zac
- Zachariah Rosenberg
- January 15, 2015
- Like
- 0
- Continue reading or reply
Looking for some rollup coding help
shows amount of times the activity shows as No Answer, Answering Machine etc and also updates the lead status aswell.
Basic functions to allow me to remove some leads from list view after we have attempted them a few times.
- Fiona Hunter
- January 12, 2015
- Like
- 0
- Continue reading or reply
Display Buttons based on Field
My initial idea was to use record types, page layouts, and WFR's, but we already use record types and there is potentially alot of intergration from our software engineers who use this object that we don't want to worry about messing that up. So while we work that part out, is there anything programatically we can do to show or hide buttons based on a field on the record? Without using record types?
- Felicia Abramson - Bit9
- December 18, 2014
- Like
- 0
- Continue reading or reply
CSS is not working,When Visualforce page render as a PDF
I am trying to creat visualforce page,and it's render as a PDF,But CSS is working only when i write inline style, But It's not working when i write different in class,
For expriment You can take w3 school sample code :
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_layout_divs and page render as PDF
Any comment ? Any Idea ? Any suggestion ?
- Anil Savaliya
- December 11, 2014
- Like
- 0
- Continue reading or reply
Non-selective query
I've come across to an error in one of my apex classes:
Error:Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ClientInvoiceAfterUpdate: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0Tb000000E6kACEAZ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ClientInvoiceAfterUpdate: execution of AfterUpdate caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times) Class.AP516_SetTECHAmountDue.updateTechAmountDue: line 29, column 1 Trigger.ClientInvoiceAfterUpdate: line 189, column 1: [] Class.AP511_SetTechTotalAmountDue.updateAmtDueCurrency: line 149, column 1 Trigger.ClientInvoiceAfterUpdate: line 177, column 1: []
The query is really simple and, as sugested by salesforce, I've splitted the filters of the query to see if in any of them, the result is greater than 100k records. The object where this query is running against to, has more than 100k records as well but the filter when applied separately retrieves way less than 100k records.
Your help and guidance are really appreciated
Best Regards,
Roniel Navarro
- Roniel Navarro
- November 25, 2014
- Like
- 0
- Continue reading or reply
Not able to see future method logs
I am not able to see future method logs in production server where as I can see thos elogs on my sandbox account ?
Can anyone please help me, How can I enable future method logs in production server ?
Note : However I can see application logs in my production salesforce.
Thank,
Abhishek
- Abhishek Kedari
- November 20, 2014
- Like
- 0
- Continue reading or reply
Manually code menu in customer portal
How can I do this?
- Imran Rahman 3
- September 26, 2014
- Like
- 0
- Continue reading or reply
How can I correct Incorrect Time Zone in Visual Force Email Template?
<b>Open Date:</b> <apex:outputText value="{0,date,EEEE, MMMMM dd, yyyy 'at' HH:mm:ss z}"><apex:param value="{!relatedto.BMCServiceDesk__openDateTime__c}" /></apex:outputText><br/>
However this is showing the time as GMT and not BST so is one hour behind. How would I correct this?
Thanks in advance for any input
Sonya
- Coral Racing
- June 06, 2014
- Like
- 0
- Continue reading or reply
How to query our Salesforce data from the front-end
We'd like to be able to query some of our Salesforce data from our front-end web app in order to get some information back for the current application user. Specifically we would like to query Salesforce based on a contact role email address in order to determine what Salesforce accoutn they are associated as well as retrieving information from related account opportunities.
Thanks, Paul
- Paul Howe
- June 06, 2014
- Like
- 0
- Continue reading or reply
Apex Trigger Creation to Sum Case field from Work Order Formula Currency Field
First time question here from a Apex Newbie.....
I have a standard object (Case) which will have a currency field, that I want to update from a rollup summary field on a custom object (Work Order) called Price__c. The Price__c field on the Work Order Custom Object totals all work order work detail lines, and I want the Price__c field to update the currency field on the case record.
So far I have the following code written, but I am getting an Invalid Ofreign Key error when tring to quick save. Can anyone help me here......Thank you in advance
trigger DoRollup on SVMXC__Service_Order__c (after insert, after update, after delete, after undelete) {
Set<Id> setCaseId=new Set<Id>();
Map<string,decimal> CaseWithTotalWorkOrders=new Map<string,decimal>();
for(SVMXC__Service_Order__c mst:Trigger.New){
if(Case.Total_Billable_Work_Orders__c!=null){
setCaseId.add(mst.SVMXC__Service_Order__c.Price__c);
}
}
}
- Shawn Reichner
- June 04, 2014
- Like
- 0
- Continue reading or reply
Why do I get error Error: Method does not exist or incorrect signature: milestoneUtils.completeMilestone(LIST<Id>, String, Datetime)
trigger completeFirstResponseCaseComment on CaseComment (after insert) {
// Cannot be a portal user
if (UserInfo.getUserType() == 'Standard'){
DateTime completionDate = System.now();
List<Id> caseIds = new List<Id>();
for (CaseComment cc : Trigger.new){
// Only public comments qualify
if(cc.IsPublished == true)
caseIds.add(cc.ParentId);
}
if (caseIds.isEmpty() == false){
List<Case> caseList = [Select c.Id, c.ContactId, c.Contact.Email,
c.OwnerId, c.Status,
c.EntitlementId, c.SlaStartDate,
c.SlaExitDate
From Case c
Where c.Id IN :caseIds];
if (caseList.isEmpty() == false){
List<Id> updateCases = new List<Id>();
for (Case caseObj:caseList) {
// consider an outbound email to the contact on the case a valid first response
if ((caseObj.Status == 'In Progress')&&
(caseObj.EntitlementId != null)&&
(caseObj.SlaStartDate <= completionDate)&&
(caseObj.SlaStartDate != null)&&
(caseObj.SlaExitDate == null))
updateCases.add(caseObj.Id);
}
if(updateCases.isEmpty() == false)
milestoneUtils.completeMilestone(updateCases, 'First Response', completionDate);
}
}
}
}
Then I try to create a milestoneutils class :
public class milestoneUtils {
public static void completeMilestone(List<Id> caseIds, String milestoneName, DateTime complDate) {
List<CaseMilestone> cmsToUpdate = [select Id, completionDate
from CaseMilestone cm
where caseId in :caseIds and cm.MilestoneType.Name=:milestoneName and completionDate = null limit 1];
if (cmsToUpdate.isEmpty() == false){
for (CaseMilestone cm : cmsToUpdate){
cm.completionDate = complDate;
}
update cmsToUpdate;
} // end if
}
// test methods
static testMethod void testCompleteMilestoneCase(){
Contact oContact = [select id from Contact limit 1];
String contactId;
if (oContact != null)
contactId = oContact.Id;
Entitlement entl = [select id from Entitlement limit 1];
String entlId;
if (entl != null)
entlId = entl.Id;
List<Case> cases = new List<Case>{};
if (entlId != null){
Case c = new Case(Subject = 'Test Case with Entitlement ', EntitlementId = entlId, ContactId = contactId);
cases.add(c);
}
// Insert the Account records that cause the trigger to execute.
if (cases.isEmpty()==false){
insert cases;
List<Id> caseIds = new List<Id>();
for (Case cL : cases){
caseIds.add(cL.Id);
}
milestoneUtils.completeMilestone(caseIds, 'First Response', System.now());
}
}
static testMethod void testCompleteMilestoneViaCase(){
// Perform data preparation
Entitlement entl = [select id from Entitlement limit 1];
String entlId;
if (entl != null)
entlId = entl.Id;
List<Case> cases = new List<Case>{};
for(Integer i = 0; i < 1; i++){
Case c = new Case(Subject = 'Test Case ' + i);
cases.add(c);
if (entlId != null){
c = new Case(Subject = 'Test Case with Entitlement ' + i, EntitlementId = entlId);
cases.add(c);
}
}
// Insert the Account records that cause the trigger to execute.
insert cases;
List<CaseComment> ccs = new List<CaseComment>{};
for(Case c : cases){
CaseComment cc = new CaseComment(CommentBody='TestPublic', IsPublished=true, ParentId=c.Id);
ccs.add(cc);
cc = new CaseComment(CommentBody='TestPrivate', IsPublished=false, ParentId=c.Id);
ccs.add(cc);
}
if (ccs.isEmpty()==false)
insert ccs;
// Now create emailmessage objects for them.
List<EmailMessage> emails = new List<EmailMessage>();
for(Case c : cases){
emails.add(new EmailMessage(parentId = c.id));
}
if(emails.isEmpty()==false)
database.insert(emails);
for(Case c : cases){
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddr = new String[] {'mramsey@salesforce.com'};
mail.setToAddresses(toAddr);
mail.setSaveAsActivity(false);
mail.setTargetObjectId(c.ContactId);
mail.setWhatId(c.Id);
mail.setHtmlBody('TestHTMLBody');
mail.setPlainTextBody('TestTextBody');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
for(Case c : cases){
c.Status = 'Closed';
}
update cases;
// Query the database for the newly inserted records.
List<Case> insertedCases = [SELECT Subject,
Description,
(SELECT IsPublished, CommentBody From CaseComments),
(SELECT TextBody, Subject, Incoming From EmailMessages)
FROM Case
WHERE Id IN :cases];
}
}
But still not luck, I get this error:
: Compile Error: Didn't understand relationship 'EmailMessages' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 103 column 36
- Adelchi Pelizzo
- May 23, 2014
- Like
- 0
- Continue reading or reply
Errors to Delete records
@istest
public class del1
{
static testmethod void unittest() {
List<opportunitylineitem> ol = [select id from opportunitylineitem where id =: '00km0000001WVUSAA4'] ;
delete ol;
}
}
- Newbie 2014
- May 16, 2014
- Like
- 0
- Continue reading or reply
Get rich text picture URL
- Vinar Amrutia
- May 15, 2014
- Like
- 0
- Continue reading or reply
Apex Trigger issue: Edit/Save Phone number on Contact page
Error:Apex trigger updateCustomObjects caused an unexpected exception, contact your administrator: updateCustomObjects: execution of AfterUpdate caused by: System.LimitException: Attempted to schedule too many concurrent batch jobs in this org (limit is 5).: Trigger.updateCustomObjects: line 73, column 1
- peter.olivier1.3897275862899202E12
- May 15, 2014
- Like
- 2
- Continue reading or reply
Need salesforce job support for a project.
Anyone interested reply or send an email to salesfo401@gmail.com.
Thanks.
- mk vr
- April 20, 2014
- Like
- 2
- Continue reading or reply