-
ChatterFeed
-
5Best Answers
-
0Likes Received
-
0Likes Given
-
48Questions
-
57Replies
Access an Account Id in test class
Here is the beginning of my test class wehre I'm setting up test records. I'm getting an error: "Error: Compile Error: unexpected token: 'Acct.ID' at line 11 column 107"
Later in the code I can easily access User fields (U.id for example). Why can't I access Acct.Id? Is it because it is in SOQL statement? Thanks!
//set up records User U = [select id from USer limit 1]; //setup Account record Account Acct = ([select id, type__c from Account limit 1]); Acct_Plan__c ap = ([select Id, Name, Account__c, Planning_Year__c from Acct_Plan__c where Account__c = Acct.Id]);
-
- acoustic
- February 15, 2013
- Like
- 0
- Continue reading or reply
Publisher Action in Lightning Components is Undefined
Components
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" > <!--<ltng:require scripts="/resource/canvas/canvasall.js" afterScriptsLoaded="{!c.jsLoaded}" />--> <ltng:require scripts="/canvas/sdk/js/36.0/publisher.js" afterScriptsLoaded="{!c.jsLoaded}" /> <ltng:require scripts="/canvas/sdk/js/36.0/controller.js"/> <ui:button label="Framework Button" press="{!c.handleClick}"/> <force:canvasApp developerName="NodeJS_app" canvasId="testing" /> </aura:component>
Controller
({ jsLoaded: function(component, event, helper) { console.log('canvas ready to go'); }, handleClick : function(cmp, event) { console.log(Sfdc) Sfdc.canvas.publisher.publish({name : 'mynamespace.myevent', payload : {'fff':'ff'}, target : {canvas : 'testing'}}); } })Error
Uncaught Action failed: c$rebootApp$controller$handleClick [Cannot read property 'publish' of undefined]
-
- Mktdev
- December 21, 2016
- Like
- 0
- Continue reading or reply
AJAX Custom Header
$.ajax({ url:"https://zzzzzzz.salesforceliveagent.com/chat/rest/System/SessionId", dataType: 'json', Accept : "text/plain; charset=utf-8", type: 'GET', contentType: 'application/x-www-form-urlencoded', headers: { 'X-LIVEAGENT-API-VERSION': '30', 'X-LIVEAGENT-AFFINITY': 'null' }, success:function(json){ alert("Success"); }, error:function(textStatus ){ console.log(textStatus ); alert("Error"+textStatus ); } });
-
- Mktdev
- December 01, 2014
- Like
- 0
- Continue reading or reply
Live Agent REST API Call Not working
In the browser console I see the request is going out but when I try to see the request header its missing these two headers instead I only see these under Access-Control-Request-Headers:x-liveagent-affinity, x-liveagent-api-version
Error: Status Code: 400 Bad Request
Any thought?
$.ajax({ url:"https://zzzzzzz.salesforceliveagent.com/chat/rest/System/SessionId", dataType: 'json', Accept : "text/plain; charset=utf-8", type: 'GET', contentType: 'application/x-www-form-urlencoded', headers: { 'X-LIVEAGENT-API-VERSION': '30', 'X-LIVEAGENT-AFFINITY': 'null' }, success:function(json){ alert("Success"); }, error:function(textStatus ){ console.log(textStatus ); alert("Error"+textStatus ); } });
-
- Mktdev
- November 28, 2014
- Like
- 0
- Continue reading or reply
Nested Query Update
I am trying to update Parent and child object using Nest Query but child records are not getting saved.
Public List<Account> getAccount(){ list<Account> acc = [select Id, Name,Country, (select Id, FirstName,LastName,Email from contact) from account where Id=: a.Id]; return acc; }
<apex:repeat var="a" value="{!Account}"> <apex:outputText value="{!a.Name}"/> <apex:repeat var="c" value="{!a.Contacts}"> <apex:inputfield value="{!c.FirstName}"> <apex:inputfield value="{!c.LastName}"> <apex:inputfield value="{!c.Email}"> </apex:repeat> <apex:repeat>
-
- Mktdev
- March 29, 2013
- Like
- 0
- Continue reading or reply
Rest API - updating Record
Hi,
I am trying to update record. I tried both PATCH and POST as instructed in document but its not working.
when used Patch then I get "Invalid HTTP method: PATCH"
when I used POST then I get
"message" : "HTTP Method 'POST' not allowed. Allowed are HEAD,GET,PATCH,DELETE", "errorCode" : "METHOD_NOT_ALLOWED"
Can anyone help? Below the code
HttpRequest req = new HttpRequest(); req.setEndpoint('https://ap1.salesforce.com'+'/services/data/v26.0/sobjects/Contact/0039000000Jzxts'); req.setHeader('Authorization', 'OAuth ' + UserInfo.getSessionId()); req.setHeader('X-PrettyPrint', 'true'); req.setHeader('Content-Type','application/json'); req.setBody('{"FirstName":"Mktg"}'); req.setMethod('PATCH'); system.debug('URL---'+UserInfo.getSessionId()); Http http = new Http(); HTTPResponse res = http.send(req);
-
- Mktdev
- March 26, 2013
- Like
- 0
- Continue reading or reply
Mixed_DML_operation with Batch Apex
Hi,
I am trying to update user in a batch apex and when there is any error I am trying capture those and store in a custom object but I am getting Mixed DML operation error.
Here is the flow:
- Contact Updated during the course of the day
- All contacts are flagged for nightly processing
- At the mid night my Batch apex picks up those contact and then verify existence of portal user for them.
- If portal user exist and there is change in the email then i want to update username and email both
- If any error occur like Username already exist, duplicate user etcs I want to track in custom object.
Please suggest.
Snip of code:
Batch Apex:
Database.SaveResult[] updateResult = Database.update(lstUserToUpdate,false); ExpectionTrackingCls.getErrorStatus(lstUserToUpdate,updateResult);
ExpectionTrackingCls
public static void getErrorStatus(List<User> lstUser,LIST<Database.SaveResult> dbSaveResult) { List<Errorlog__c> errObj=new List<Errorlog__c>(); for(Database.SaveResult sr : dbSaveResult){ if (sr.isSuccess()==false) { for(Database.Error err : errs) { Errorlog__c newErrorRecord = new Errorlog__c(); newErrorRecord.name = lstUser[i].username; newErrorRecord.message__c = err.getMessage()+err.getStatusCode(); errObj.add(newErrorRecord); } } } }
-
- Mktdev
- February 15, 2013
- Like
- 0
- Continue reading or reply
webservice call to receive 10000 records
Hi,
We are planning to schedule a webservice call to external system and in response we might get 10000 records.What will be the best approach should we take to process all those 10000 records and updates salesforce database.
Regards,
mktdev
-
- Mktdev
- October 18, 2012
- Like
- 0
- Continue reading or reply
Refreshing Salesforce from homepage component containing VF page
Hi,
I need a help to refresh my salesforce page with a button in a VF page placed in home page component.
My VF page just has one button called Refresh. This VF page is placed in Home pagecomponent as HTML type using iframe tag.
I want to refresh the complete page on click on this button.With below javascript I able to refresh salesforce with I am in VF page(https://c.ap1.visual.force.com/apex/abc) in the URL but it doesnt work when we have standard salesforce page(https://ap1.salesforce.com/home.jsp).
<script>
parent.location.reload();
</script>
Please suggest.
-
- Mktdev
- October 17, 2012
- Like
- 0
- Continue reading or reply
Comparing One field value against one custom object
Hi,
I want to compare field value against a custom object record.
I have one field which contains a code of the product and a custom object which contains active product code.
when user enters the code in the field I want to check whether the product enter is valid or not.if not then set that field value to Product not supported.
For example if user enter 1111 and custom object has one record with 1111 then its ok but if not found than place Product Not Support.
I created one Map with <Id,String> and one Set<String> this holds the unique product code. now I queried the custom object and store the value in Set<String>.
Now when I m trying to compare based on filter set its not working for me can anyone help.
Regards,
mktg
-
- Mktdev
- January 04, 2012
- Like
- 0
- Continue reading or reply
Poping up another Visualforce page from inlineVisualforce and once close of pop up main to refresh
Hi,
I want to have one inline visualforce page with a button on case .when user click on button they should popup another visualforce page and on xlose of pop refresh the the parent page. same as lookup functionality.
regards,
mukesh
-
- Mktdev
- December 04, 2011
- Like
- 0
- Continue reading or reply
Visualforce email template: Showing and Hiding Labels based on one field
Hi,
Can we write javascript onload on visualforce email template.
-
- Mktdev
- November 16, 2011
- Like
- 0
- Continue reading or reply
Code based Sharing Rule calculation on assignment rule
Hi ,
I had one requirement where we have to share case on creation, to contact partner role based on the contact in case object.Means when a case is created we check whether the case contact is of partner role and if yes then share the case with its role so that anyone in that role can access this case.
It is working well in salesforce but when a case is created from partner portal all the debugs logs are correct but the entry is missing from case share table.
Please suggest.
Regards,
Mktg
-
- Mktdev
- October 31, 2011
- Like
- 0
- Continue reading or reply
Overridding Delete button to add extra step before deleting
Hi,
I want to override the Delete button to add addition step before deletion.
Account is related to an custom object
1) if user goes to delete the custom object relationship then
2) user should be promoted with a VF page where he has to lookup a contact to assign his cases to another user.
Query:
How can I get the Id of deleting record using overridding button?
-
- Mktdev
- August 15, 2011
- Like
- 0
- Continue reading or reply
Knowledgement- Restricting all Portal user to view Articles based on Data Category Group
Since Portal User roles are created runtime so how to restrict a Articles based on Data Category Group.
-
- Mktdev
- August 04, 2011
- Like
- 0
- Continue reading or reply
Customer Portal Role Hierarchy
Hi,
Any one have any idea how to use the Customer Portal Role Hierarchy.
Since Customer Portal role has three role executive,manager and user.Now suppose user having User role are creating case so if we assign a user with Manager role then he/she can see all cases raised by User Role users.
But I want that if a User Role user is Reporting to XYZ manager then only XYZ manager can see his cases not all the managers.
Manager1 Manager2 Manager3
| | |
User1,User2 User3,User4 User5,User6
Currently Manager1 can see user3,user4,user5 and user6 cases and same for other.
I tried using Manager field but that doesnot allow us to select portal user.
Thanks is advance!
Regards,
Mktg
-
- Mktdev
- August 02, 2011
- Like
- 0
- Continue reading or reply
creating one map using two maps based on keyset
Hi,
I have two map one is Contact Account and another is Contact User .I want to create another map by comparing these two and create a new map for Account User.
Please help.
Regards,
Mktg
-
- Mktdev
- July 26, 2011
- Like
- 0
- Continue reading or reply
-
- Mktdev
- May 04, 2011
- Like
- 0
- Continue reading or reply
First integration help
Hi,
I am writing my first integration between one salesforce to another salesforce.
In First salesforce, I wrote one simple web service class which will create a new account based on the information coming from another salesforce.
In second salesforce, I have used workflow rule with any new account created here will send a outbound message to first salesforce .Outbound message has endpoint URL which has been generated by first salesforce class wsdl generated by salesforce.
but when I create account in second salesforce then sends the request but getting a error of "INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session".
So can any help me to understand the issue:
- Why this error?
- I guess that UserID and Pwd not passed so how to do that?
- Do this require same user credential.
Please help
Regards,
mktg
-
- Mktdev
- April 08, 2011
- Like
- 0
- Continue reading or reply
Under Construction Page
Hi ,
I have one site for I want to update/change the look and feel of underconstruction page.When any person enters the WRONG URL so he get the underconstruction page with clock and tool box icon and URL of the active site.Instead I want show my company logo and the URL as embedded as link as shown here.
But when I try to this its is not making any chances.
Regards,
Mktg
-
- Mktdev
- March 31, 2011
- Like
- 0
- Continue reading or reply
Customer Portal Login for Site
Hi,
What are the limitations of using customer portal logins for Site? Is there any cost involved in it.
Regards,
mktg
-
- Mktdev
- February 02, 2011
- Like
- 0
- Continue reading or reply
Publisher Action in Lightning Components is Undefined
Components
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" > <!--<ltng:require scripts="/resource/canvas/canvasall.js" afterScriptsLoaded="{!c.jsLoaded}" />--> <ltng:require scripts="/canvas/sdk/js/36.0/publisher.js" afterScriptsLoaded="{!c.jsLoaded}" /> <ltng:require scripts="/canvas/sdk/js/36.0/controller.js"/> <ui:button label="Framework Button" press="{!c.handleClick}"/> <force:canvasApp developerName="NodeJS_app" canvasId="testing" /> </aura:component>
Controller
({ jsLoaded: function(component, event, helper) { console.log('canvas ready to go'); }, handleClick : function(cmp, event) { console.log(Sfdc) Sfdc.canvas.publisher.publish({name : 'mynamespace.myevent', payload : {'fff':'ff'}, target : {canvas : 'testing'}}); } })Error
Uncaught Action failed: c$rebootApp$controller$handleClick [Cannot read property 'publish' of undefined]
- Mktdev
- December 21, 2016
- Like
- 0
- Continue reading or reply
Nested Query Update
I am trying to update Parent and child object using Nest Query but child records are not getting saved.
Public List<Account> getAccount(){ list<Account> acc = [select Id, Name,Country, (select Id, FirstName,LastName,Email from contact) from account where Id=: a.Id]; return acc; }
<apex:repeat var="a" value="{!Account}"> <apex:outputText value="{!a.Name}"/> <apex:repeat var="c" value="{!a.Contacts}"> <apex:inputfield value="{!c.FirstName}"> <apex:inputfield value="{!c.LastName}"> <apex:inputfield value="{!c.Email}"> </apex:repeat> <apex:repeat>
- Mktdev
- March 29, 2013
- Like
- 0
- Continue reading or reply
Rest API - updating Record
Hi,
I am trying to update record. I tried both PATCH and POST as instructed in document but its not working.
when used Patch then I get "Invalid HTTP method: PATCH"
when I used POST then I get
"message" : "HTTP Method 'POST' not allowed. Allowed are HEAD,GET,PATCH,DELETE", "errorCode" : "METHOD_NOT_ALLOWED"
Can anyone help? Below the code
HttpRequest req = new HttpRequest(); req.setEndpoint('https://ap1.salesforce.com'+'/services/data/v26.0/sobjects/Contact/0039000000Jzxts'); req.setHeader('Authorization', 'OAuth ' + UserInfo.getSessionId()); req.setHeader('X-PrettyPrint', 'true'); req.setHeader('Content-Type','application/json'); req.setBody('{"FirstName":"Mktg"}'); req.setMethod('PATCH'); system.debug('URL---'+UserInfo.getSessionId()); Http http = new Http(); HTTPResponse res = http.send(req);
- Mktdev
- March 26, 2013
- Like
- 0
- Continue reading or reply
Mixed_DML_operation with Batch Apex
Hi,
I am trying to update user in a batch apex and when there is any error I am trying capture those and store in a custom object but I am getting Mixed DML operation error.
Here is the flow:
- Contact Updated during the course of the day
- All contacts are flagged for nightly processing
- At the mid night my Batch apex picks up those contact and then verify existence of portal user for them.
- If portal user exist and there is change in the email then i want to update username and email both
- If any error occur like Username already exist, duplicate user etcs I want to track in custom object.
Please suggest.
Snip of code:
Batch Apex:
Database.SaveResult[] updateResult = Database.update(lstUserToUpdate,false); ExpectionTrackingCls.getErrorStatus(lstUserToUpdate,updateResult);
ExpectionTrackingCls
public static void getErrorStatus(List<User> lstUser,LIST<Database.SaveResult> dbSaveResult) { List<Errorlog__c> errObj=new List<Errorlog__c>(); for(Database.SaveResult sr : dbSaveResult){ if (sr.isSuccess()==false) { for(Database.Error err : errs) { Errorlog__c newErrorRecord = new Errorlog__c(); newErrorRecord.name = lstUser[i].username; newErrorRecord.message__c = err.getMessage()+err.getStatusCode(); errObj.add(newErrorRecord); } } } }
- Mktdev
- February 15, 2013
- Like
- 0
- Continue reading or reply
Access an Account Id in test class
Here is the beginning of my test class wehre I'm setting up test records. I'm getting an error: "Error: Compile Error: unexpected token: 'Acct.ID' at line 11 column 107"
Later in the code I can easily access User fields (U.id for example). Why can't I access Acct.Id? Is it because it is in SOQL statement? Thanks!
//set up records User U = [select id from USer limit 1]; //setup Account record Account Acct = ([select id, type__c from Account limit 1]); Acct_Plan__c ap = ([select Id, Name, Account__c, Planning_Year__c from Acct_Plan__c where Account__c = Acct.Id]);
- acoustic
- February 15, 2013
- Like
- 0
- Continue reading or reply
Metadata API Deployment Not pushing System Permissions
How do you get the System Permissions to be pulled?
I am working on building a Metadata deployment for our company, and part of the deployment includes creating several new profiles. We are trying to capture all of the permissions for these profiles, but can't seem to get the system permissions to match in our test runs.
I know that when you retrieve the profile object, what you get is dynamic, based on what other object you are retrieving. (see Chap 4 bullet 2 of the Migration Guide)
The Following System Permissions are different between our source and destination environment
Customize Application Manage Connections Manage Custom Report Types Manage Dashboards Manage Public Documents Manage Public List Views Manage Public Reports Manage Public Templates Manage Translation Manage Users Modify All Data Reset User Passwords and Unlock Users + Send Email Transfer Record View All Data
note: + indicates added in the destination. All others are lost.
- Roth2842
- October 18, 2012
- Like
- 0
- Continue reading or reply
Poping up another Visualforce page from inlineVisualforce and once close of pop up main to refresh
Hi,
I want to have one inline visualforce page with a button on case .when user click on button they should popup another visualforce page and on xlose of pop refresh the the parent page. same as lookup functionality.
regards,
mukesh
- Mktdev
- December 04, 2011
- Like
- 0
- Continue reading or reply
Visualforce email template: Showing and Hiding Labels based on one field
Hi,
Can we write javascript onload on visualforce email template.
- Mktdev
- November 16, 2011
- Like
- 0
- Continue reading or reply
Overridding Delete button to add extra step before deleting
Hi,
I want to override the Delete button to add addition step before deletion.
Account is related to an custom object
1) if user goes to delete the custom object relationship then
2) user should be promoted with a VF page where he has to lookup a contact to assign his cases to another user.
Query:
How can I get the Id of deleting record using overridding button?
- Mktdev
- August 15, 2011
- Like
- 0
- Continue reading or reply
Customer Portal Role Hierarchy
Hi,
Any one have any idea how to use the Customer Portal Role Hierarchy.
Since Customer Portal role has three role executive,manager and user.Now suppose user having User role are creating case so if we assign a user with Manager role then he/she can see all cases raised by User Role users.
But I want that if a User Role user is Reporting to XYZ manager then only XYZ manager can see his cases not all the managers.
Manager1 Manager2 Manager3
| | |
User1,User2 User3,User4 User5,User6
Currently Manager1 can see user3,user4,user5 and user6 cases and same for other.
I tried using Manager field but that doesnot allow us to select portal user.
Thanks is advance!
Regards,
Mktg
- Mktdev
- August 02, 2011
- Like
- 0
- Continue reading or reply
creating one map using two maps based on keyset
Hi,
I have two map one is Contact Account and another is Contact User .I want to create another map by comparing these two and create a new map for Account User.
Please help.
Regards,
Mktg
- Mktdev
- July 26, 2011
- Like
- 0
- Continue reading or reply