Satyakam Singh
IndividualForum Replies Created
-
Satyakam
MemberDecember 6, 2016 at 7:21 am in reply to: How can we use Page Block Section In Visualforce Pages In Salesforce Lightning Experience ?Hi sushant,
You can use <apex:pageBlockSecton> in visualforce page in classis but this tag is not supported in lightning.
you may switch to Lightning Experience from classis.
Ex-
<apex:page standardController="Account">
<apex:form>
<apex:pageBlock>
<apex:pageBlockSection>
...........................
code here
..........................
</apex::pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
You have to follow above steps to get your page block section.
Thanks
-
Satyakam
MemberDecember 6, 2016 at 7:10 am in reply to: In Salesforce, We use XML file in Visualforce pages. What does this mean?Hi sushant,
we can download xml file using contentType in visualforce page.
<apex:page controller="TestController" contentType="application/xml">
..........................
</apex:page>
we use xml file to upload in salesforce using visualforce page and apex controller.
Visualforce page-
<apex:page standardController="Account" extensions="attachmentsample"> <apex:form > <apex:sectionHeader title="Upload an Attachment"/> <apex:pageblock > <apex:pageblocksection columns="1"> <apex:inputfile value="{!myfile.body}" filename="{!myfile.Name}" /> <apex:commandbutton value="Save" action="{!Savedoc}"/> </apex:pageblocksection> </apex:pageblock> </apex:form> </apex:page>
Apex Controller-
public class attachmentsample { public attachmentsample(ApexPages.StandardController controller) { } Public Attachment myfile; Public Attachment getmyfile() { myfile = new Attachment(); return myfile; } Public Pagereference Savedoc() { String accid = System.currentPagereference().getParameters().get('id'); Attachment a = new Attachment(parentId = accid, name=myfile.name, body = myfile.body); /* insert the attachment */ insert a; return NULL; } }
This may help you to understand,why we use xml file in salesforce.
Thanks
- This reply was modified 7 years, 11 months ago by Satyakam.
-
Satyakam
MemberDecember 6, 2016 at 6:39 am in reply to: Generate MS-Word document (.docx) using Salesforce Visualforce pagesHi Arshadulla,
In your Visualforce page,you have to add contentType to get any type of files.
<apex:page standardController="Account" showHeader="false" contentType="application/vnd.msword" >
.................
code here
...............
</apex:page>
Thanks
-
Satyakam
MemberAugust 2, 2016 at 5:57 pm in reply to: How to get Dynamic value in picklist by Javascript in Salesforce?Hii Mohit,
go through the following link:
-
Satyakam
MemberAugust 1, 2016 at 7:24 am in reply to: How can we prevent/restrict the update of any record in Salesforce?Hi Pranav,
You may solve this problem using RecordType Setting beacuse record type access is controlled at profile level. profile <Record Type Settings . Select Edit and move the <ProfileName> value to the left column (Available Record Types). Users will still be able to view <ProfileName> records, but will not be able to create or select them from their picklist.
-
Hi Mohit,
Follow the below code:
Visualforce Page:
<apex:page controller="picklistController" >
<apex:form >
<apex:pageblock >
<apex:pageBlockSection title="Dynamic picklist">
<apex:pageblocksectionItem >
<apex:outputlabel value="City" for="values" />
<apex:selectList value="{!city}" size="1" id="values">
<apex:actionSupport event="onchange" reRender="newvalue" />
<apex:selectOptions value="{!citynames}"/>
</apex:selectList>
</apex:pageblocksectionItem>
<apex:outputpanel id="newvalue">
<apex:outputpanel rendered="{!city == '--Other--'}">
<div style="position:relative;left:75px;">
<apex:outputlabel value="New value" for="newval" />
<apex:inputText value="{!newCity}" id="newval"/>
<apex:commandbutton action="{!saveCity}" value="Add!"/>
</div>
</apex:outputpanel>
</apex:outputpanel>
</apex:pageblocksection>
</apex:pageblock>
</apex:form>
</apex:page>Apex Controller:
public class picklistController
{
public String city{get; set;}public String newCity{get; set;}
public List<SelectOption> getcitynames()
{
List<SelectOption> options = new List<SelectOption>();
List<DynamicPicklist__c> citylist = new List<DynamicPicklist__c>();
citylist = [Select Id, PicklistValue__c FROM DynamicPicklist__c ];
options.add(new SelectOption('--None--','--None--'));
for (Integer j=0;j<citylist.size();j++)
{
options.add(new SelectOption(citylist[j].PicklistValue__c,citylist[j].PicklistValue__c));
}
return options;
}public void saveCity()
{
DynamicPicklist__c newrec = new DynamicPicklist__c(PicklistValue__c=newCity);
insert newrec;
newCity=NULL;
}}
-
Satyakam
MemberJuly 27, 2016 at 6:47 am in reply to: How to add existing Attachments to Visualforce Email template?Hi Tanu,
In Visualforce email template you can use below tag to render content into a PDF attachment in final email.
<messaging:attachment renderAs="PDF" filename="fileName.pdf">
email attachment content goes here.
</messaging:attachment>But if you are trying to render an already existing PDF document from say "Documents" in salesforce, you can try below steps
1) Get the content of the document by querying document.
2) Assign this document body to a property(String type) in the controller of visualforce email template. Then use the property inside above mentioned tags.
Generally if you want more control over this kind of scenario, we go for an apex trigger and from trigger we send apex generated email. In this case you can query documents or any other object or even multiple objects and control attachment contents more precisely.
Please try below code to encode the Document body as string suitable for email attachment.It worked for me while reading text Document into apex and rendering as PDF in email,
Public class pdfController {
public String pdfBody{get;set;}
public pdfController(){
Document docu = [select body from document where Id = '01590000008P7po'];
pdfBody = EncodingUtil.urlEncode(docu.body.toString(), 'UTF-8');}
} -
Satyakam
MemberJuly 27, 2016 at 6:17 am in reply to: While sending an email in salesforce is there any method to know that the sent email is delivered or not?Hi Pranav,
To check wheather email is delivered or not you'll have to follow the link given
belhttps://www.shellblack.com/administration/email-deliverabilty-and-html-status-reports/
-
Satyakam
MemberJuly 26, 2016 at 7:32 am in reply to: How to restrict tab/view/Object in salesforce other than Profile?hi Tanu,
You can go through Permission Set.A Permission Set is a collection of settings and permissions that give users access to various tools and functions.
-
Satyakam
MemberJuly 19, 2016 at 8:51 am in reply to: How to create a vf page automatically on creation of Account?Hi,
if you want to show another vf page after inserting an account,than you should use pagereference for another vf page and show all the details of account using <apex:outputText >.
-
Satyakam
MemberJuly 19, 2016 at 8:46 am in reply to: How can we write a such apex controller class which can be used by multiple vf pages on requirement?hi,
you can use one apex controller for multiple vf pages as your requirement.you can call all functions by your vf pages using single apex controller.
<apex:page controller="ApexController">
you can use apex controller in every vf page as above i have written.
-
Satyakam
MemberJuly 19, 2016 at 8:40 am in reply to: How to set a particular field for an user read only from page layout?hi mohit,
using page layout you can use field properties or you may go through field-level-security for perticular field permission.
-
Is there any other similar idea to solve this problem,we have a situation like if i have a list of account and i want to show all the contacts related to any one account,how i ll get that?
-
Satyakam
MemberMay 25, 2016 at 1:19 pm in reply to: How can I get the value of the dependent picklist ?Hii Piyush,
This is the scenario for dependent picklist.When you click on country picklist and select india than you will get related states to india in states picklist field and when you ll choose any state than you will get related cities to that state.
code is here :
Visualforce Page:
<apex:page controller="sample">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection columns="2">
<apex:pageBlockSectionItem >
<apex:outputLabel value="country"/>
</apex:pageBlockSectionItem>
<apex:selectList size="1" value="{!country}">
<apex:selectOptions value="{!countries}"/>
<apex:actionSupport event="onchange" reRender="a"/>
</apex:selectList>
<apex:pageblockSectionItem >
<apex:outputLabel value="state"/>
</apex:pageblockSectionItem>
<apex:pageblockSectionItem >
<apex:selectList size="1" value="{!state}" id="a">
<apex:selectOptions value="{!states}"/>
<apex:actionSupport event="onchange" reRender="b"/>
</apex:selectList>
</apex:pageblockSectionItem>
<apex:pageblockSectionItem >
<apex:outputLabel value="city"/>
</apex:pageblockSectionItem>
<apex:pageblockSectionItem >
<apex:selectList size="1" value="{!city}" id="b">
<apex:selectOptions value="{!cities}"/>
</apex:selectList>
</apex:pageblockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock></apex:form>
</apex:page>
Controller:
public class sample
{
public String country{get;set;}
public String state {get;set;}
public String city {get;set;}public List<SelectOption> getCountries()
{
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('None','--- None ---'));
options.add(new SelectOption('US','USA'));
options.add(new SelectOption('IN','India'));
options.add(new SelectOption('AUS','Australia'));
return options;
}public List<SelectOption> getStates()
{
List<SelectOption> options = new List<SelectOption>();
if(country=='US')
{
options.add(new SelectOption('NYK','NewYork'));
options.add(new SelectOption('WSTN','Washington'));
}
else if(country=='IN'){
options.add(new SelectOption('DLI','Delhi'));
options.add(new SelectOption('MUM','Mumbai'));
}
else if(country=='AUS'){
options.add(new SelectOption('SYD','Sydney'));
options.add(new SelectOption('MLB','Melburn'));
}
return options;
}
public List<SelectOption> getCities()
{
List<SelectOption> options = new List<SelectOption>();
if(country == 'US')
{
if(state == 'NYK'){
options.add(new SelectOption('C1','City1'));
options.add(new SelectOption('C2','City2'));
}
else if(state == 'WSTN')
{
options.add(new SelectOption('C3','City3'));
options.add(new SelectOption('C4','City4'));
}
}
else if(country == 'IN')
{
if(state== 'DLI'){
options.add(new SelectOption('C5','City5'));
options.add(new SelectOption('C6','City6'));
}
else if(state=='MUM'){
options.add(new SelectOption('C7','City7'));
options.add(new SelectOption('C8','City8'));
}
}
else if(country=='AUS'){
if(state=='SYD'){
options.add(new SelectOption('C9','City9'));
options.add(new SelectOption('C10','City10'));
}
else if(state=='MLB'){
options.add(new SelectOption('C11','City11'));
options.add(new SelectOption('C12','City12'));
}
}return options;
}
}i hope this code will help you.
-
Satyakam
MemberMay 25, 2016 at 12:32 pm in reply to: Can anyone help me with Model, View and Controller concept in Salesforce?Salesforce MVC-
We write SFDC visual force (VF pages). Each VF page is associated with a Controller and this controller may be a custom controller or a standard controller.Visualforce uses the model-view-controller (MVC) paradigm.
Saleforce MVC pattern contains below three modules:
1.Model
2.View
3.ControllerModel:
What schema and data does salesforce uses to represent the system completely. In salesforce, we can say that sObjects are the model as every entity in salesforce is mapped to some sObject.
View:
How the schema and data is represented. Visualforce is used to present the data to users.
Controller:
How the interface actions. Controllers are used to perform the actions whenever users interact with visual force.
-
Satyakam
MemberMay 24, 2016 at 9:31 am in reply to: How to set up Auto Response Rule with web-to-case?hii naman,
web-to-case is used to create web form or a self-service customer community to make it easy for customers to submit cases directly to your customer support group.
to set up auto response rule for web-to-case,you will have to follow the steps:
in your quick search box..type web-to-case.
click on web-to-case and you will get basic settings and auto-response email setting.
enable web-to-case checbox and choose case origin like:web.
choose email template and write your email signature.
click on save button to save auto-responsive email.
-
Satyakam
MemberMay 24, 2016 at 8:58 am in reply to: What are the data migration tools? and their limitations?hii naman,
you may go through following link:
-
hi jitesh,
you can get your solution by follwing code.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
var idCounter=1;
function checkboxClick(obj){
var id = $(obj).attr("id");
console.log(id);
if($('#' + id).is(":checked")){
var str = $('#' + id).closest("tr").text();
$(obj).closest("tr").remove();$('#allNames').append('<option value="'+str+'"/>');
}
}
$(document).ready(function() {
$('#name').on('input', function() {
var userText = $(this).val();
console.log(userText);
$("#allNames").find("option").each(function() {
if($(this).val() == userText) {
$(this).remove();
$("#name").val(null);
//$(userText).null();var b = $('#demo').append('<tr><td><input type="checkbox" onclick="checkboxClick(this)" id="ck_'+idCounter+'"/></td><td class="newLine">'+userText+'</td></tr>');
idCounter++;
}
});
});
});
</script> -
Satyakam
MemberApril 14, 2016 at 8:34 am in reply to: Can I Insert a Static Resource using Apex Code in Salesforce?hii ajit,
if you have uploaded any .zip file through static resource then you may use on vf page by following code:-
<apex:page sidebar="false" showHeader="false" standardStyleSheets="false" >
<apex:image url="{!URLFOR($Resource.CSSImage, 'images/bottom.gif')}" />
</apex:page> -
Satyakam
MemberApril 14, 2016 at 8:25 am in reply to: How to import data of a object from one org to another without using data loader and integration?hi ajit,
there are some other tools which are used to import data of a object in salesforce.you can go through following link
http://www.saaspie.com/2014/02/06/different-data-loaders-salesforce/
-
Satyakam
MemberApril 14, 2016 at 8:01 am in reply to: How can I create Email Template from a Salesforce Visualforce page?hi ajay,
you may go through following link.this may help you to solve problem.
http://sfdcsrini.blogspot.com/2014/07/visualforce-email-template-with-custom.html
- This reply was modified 8 years, 7 months ago by Satyakam.