sushant ujlayan
IndividualForum Replies Created
-
sushant
MemberJanuary 27, 2017 at 2:20 pm in reply to: How do I reset a Salesforce Lightning file input after submission?Hi Tanu
This may help you
component.find("file").getElement().value='';
Thanks
-
sushant
MemberJanuary 27, 2017 at 2:14 pm in reply to: How to populate Child Field from a Parent field in Salesforce?Hi Vikas,
Try this:
trigger trigsetLastName on Contact (after insert,after update)
{
Map<id,account> parentacc = new Map<id,account>();
Set<id> listids = new Set<id>();for( contact childobj :Trigger.new)
{
listids.add(childobj.accountid); // error in this line
}parentacc= new map<id,account> ([select id,Name ,(select id,LastName from contacts) from account where id in: listids]);
for ( contact c :trigger.new)
{
account myacc = parentacc.get(c.accountid);
myacc.Name=c.LastName;
}
Update parentacc.values();
}Thanks
-
sushant
MemberJanuary 25, 2017 at 1:20 pm in reply to: Can anyone provide some tips for testing in Salesforce?Hi Abhay,
Refer the link below,it may help you
https://developer.salesforce.com/blogs/developer-relations/2016/07/six-tips-great-unit-tests.html
Thanks
-
sushant
MemberJanuary 25, 2017 at 1:14 pm in reply to: Static Resources vs Mock Classes for testing callouts in SalesforceHi Kumar,
Refer the link below,it may help you:
Thanks
-
sushant
MemberJanuary 25, 2017 at 1:10 pm in reply to: What is Visualforce Charting and Why Would We Use Visualforce Charting in salesforce?Hi Vikas,
Visualforce charting gives you an easy way to create customized business charts, based on data sets you create directly from SOQL queries, or by building the data set in your own Apex code. By combining and configuring individual data series, you can compose charts that display your data in ways meaningful to your organization.
Visualforce charts are rendered client-side using JavaScript. This allows charts to be animated and visually exciting, and chart data can load and reload asynchronously, which can make the page feel more responsive.
Use Visualforce charting when the standard Salesforce charts and dashboards are insufficient, or when you wish to compose custom pages that combine charts and data tables in ways that are more useful to your organization.
Thanks
-
sushant
MemberJanuary 25, 2017 at 1:08 pm in reply to: What are the advantages of Visualforce Remote Objects in salesforce?Hi Vikas,
The benefit of Remote Objects is that you can access server data without using API calls or writing Apex Code. It's slower than the AJAX toolkit and the RemoteAction annotation (see this question), but does reduce the amount of Apex Code you have to write/maintain/unit-test, and, like RemoteAction, gives you access to data without using API calls. This allows Professional Edition to write functional JavaScript-based Visualforce pages, since they don't get Apex Code or API calls.
Thanks
-
sushant
MemberJanuary 24, 2017 at 1:29 pm in reply to: How can we generate an encrypted pdf from Salesforce?Hi Pranav,
you should be able to limit who can see your page by only adding specific profiles to the page.
From Setup, enter Visualforce Pages in the Quick Find box, then select Visualforce Pages.
Next to the name of the page that you want to restrict, click Security.
Select the profiles that you want to enable from the Available Profiles list and click Add.
Select the profiles that you want to disable from the Enabled Profiles list and click Remove.
Click Save.
From: https://help.salesforce.com/apex/HTViewHelpDoc?id=pages_security_page_def.htm&language=en_USThanks
-
sushant
MemberJanuary 24, 2017 at 1:26 pm in reply to: How can a trigger be implemented on the approval process action?Hi Pranav,
Follow this link,it may help You
https://developer.salesforce.com/forums/?id=906F000000091obIAA
Thanks
-
sushant
MemberJanuary 24, 2017 at 1:22 pm in reply to: How can I retrieve any deleted apex class from developer console cache?Hi Pranav,
There is an option to Restore from Local History in Eclipse. You could give that a go.
Thanks
-
sushant
MemberJanuary 23, 2017 at 10:27 am in reply to: How to find specific record Id failed in Salesforce Batch?Hi Tanu,
Implementing Database.stateful in your Batch class can help you in getting Failed Record id in Your Batch operation.
global class NBTypeBatchUpdate implements Database.Batchable<sObject>, Database.Stateful {
global String log = ''; // stateful variable to keep track of errors across batches
global Database.QueryLocator start(Database.BatchableContext BC)
{
String query = 'SELECT Id, Name, NBType__c ';
query += 'FROM Opportunity ';
query += 'WHERE ContractStartDate__c != null ';
query += 'AND ContractStartDate__c > 2014-01-01 ';
//query += 'AND NBType__c != null ';return Database.getQueryLocator(query);
}global void execute(Database.BatchableContext BC, List<sObject> scope)
{
system.debug('Processing ' + scope.size() + ' opportunities');for (Opportunity opportunity : (List<Opportunity>)scope){
system.debug('Processing ' + opportunity.Name);
opportunity.NBType__c = null;
}Database.SaveResult[] srList = database.update(scope, false); // allOrNone = false
for (Integer i = 0; i < srList.size(); i++)
if (!srList[i].isSuccess())
this.log += '\n Error in Opportunity: ' + scope[i].name + '. Error msg=' +
srList[i].getErrors()[0].getMessage();This code may help You.
Thanks
-
sushant
MemberJanuary 23, 2017 at 10:19 am in reply to: How can I find unused methods and variables?Hi Tanu,
The Tooling API can be used to retrieve the SymbolTable for each apex class. This Symbol Table will tell you the methods that are defined in the apex class, and the references to methods that are consumed in the externalReferences.
By scanning the methods and corresponding references in each apex classes symbol table you can find methods that aren't called by other apex classes.
Thanks
-
sushant
MemberJanuary 23, 2017 at 10:17 am in reply to: How to create a workflow rule between two different objects?Hi Tanu,
It is not possible to do this using workflows or process builders as they are limited to one object per rule/process.
Thanks
-
sushant
MemberJanuary 23, 2017 at 10:12 am in reply to: Can we fire a trigger in DoInit method of Salesforce Client Side Controller?Hi Tanu,
You can fire trigger only after some DML operation is performed.So you can't fire trigger in Doinit method unless any DML operation is performed.
Thanks
-
sushant
MemberJanuary 23, 2017 at 9:58 am in reply to: Can we change javascript onclick button to Salesforce lightning component attribute?Thanks
-
sushant
MemberJanuary 23, 2017 at 9:56 am in reply to: The Product object is no longer available in API Version:37.0 now represented by Product2Hi Pranav,
Now you have to change the API name for Product from Product to Product2 to make them work as before.
Thanks
-
sushant
MemberJanuary 23, 2017 at 8:11 am in reply to: What is the benefit of using css for lookup image if we have onclick tag?Hi Pranav,
css enhances the beautification of your page.Hence we use css in page.
Thanks
-
sushant
MemberJanuary 23, 2017 at 8:05 am in reply to: How to Perform show/hide toggle using JavaScript on a salesforce visualforce page?Thanks
-
sushant
MemberJanuary 23, 2017 at 8:05 am in reply to: How can we fetch data without using Controller functions on salesforce VisualForce page?Thanks
-
sushant
MemberJanuary 20, 2017 at 1:59 pm in reply to: Using SOQL queries in REST API request - SalesforceHi Kumar,
Follow this link,it may help you:
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_query.htm
Thanks
-
sushant
MemberJanuary 20, 2017 at 1:56 pm in reply to: Stuck on Trailhead Challenge : Salesforce Lightning Client Side Controllers -"mark item as packed"Hi,
To create a packing list item component, try this in controller.js:({ packItem : function(component, event, helper) { var checkbox = component.get(“v.item”,true); checkbox.Packed__c = true; component.set(“v.item”,checkbox); event.getSource().set(‘v.disabled’, true); } })
Thanks
-
sushant
MemberJanuary 20, 2017 at 1:55 pm in reply to: Not getting access token with Postman in SalesforceHi Kumar,
You probably need to include your API security token with the password. See the help topics on identity confirmation.
Thanks
-
Hi Kumar,
You can follow this link,it may help you
https://developer.salesforce.com/blogs/developer-relations/2012/08/default-namespaces-in-apex.html
Thanks
-
sushant
MemberJanuary 19, 2017 at 2:10 pm in reply to: want to return multiple lists and variables from a method in Salesforce Wrapper Class?Hi Vikas,
Following example may help you.
public class wrapperClass{
Integer int;
String str;
Account acc;
}And use this class as a return value of your method:
public static wrapperClass methodToReturnWrapper(){
wrapperClass wc = new wrapperClass();
//here you can fill in wrapper with values you want, like wc.int = 1
return wc;
}Thanks
-
Hi Vikas,
The method JSON.deserializeUntyped works well for this type of problem. What you get returned is a map:
Map<String, Object> m = (Map<String, Object>) JSON.deserializeUntyped(jsonString);
You can use the normal map methods to get hold of the keys or to see if a key is presentThanks
-
sushant
MemberJanuary 19, 2017 at 1:58 pm in reply to: Differenciate Between Auth1.0 and Auth2.0 in Salesforce.Hi Vikas,
To summarize, here are the key differences:
More OAuth Flows to allow better support for non-browser based applications. This is a main criticism against OAuth from client applications that were not browser based. For example, in OAuth 1.0, desktop applications or mobile phone applications had to direct the user to open their browser to the desired service, authenticate with the service, and copy the token from the service back to the application. The main criticism here is against the user experience. With OAuth 2.0, there are now new ways for an application to get authorization for a user.
OAuth 2.0 no longer requires client applications to have cryptography. This hearkens back to the old Twitter Auth API, which didn't require the application to HMAC hash tokens and request strings. With OAuth 2.0, the application can make a request using only the issued token over HTTPS.
OAuth 2.0 signatures are much less complicated. No more special parsing, sorting, or encoding.
OAuth 2.0 Access tokens are "short-lived". Typically, OAuth 1.0 Access tokens could be stored for a year or more (Twitter never let them expire). OAuth 2.0 has the notion of refresh tokens. While I'm not entirely sure what these are, my guess is that your access tokens can be short lived (i.e. session based) while your refresh tokens can be "life time". You'd use a refresh token to acquire a new access token rather than have the user re-authorize your application.
Finally, OAuth 2.0 is meant to have a clean separation of roles between the server responsible for handling OAuth requests and the server handling user authorization. More information about that is detailed in the aforementioned article.
Thanks