• Nizam Saifi
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies
Hi All, I want to get id from parameter in salesforce community into apex controller but not able to get it. I tried to use ApexPages.currentPage().getParameters().get('id') but it is not working 
I have created a trigger on attachment to prevent user from uploading .CSV file and showing an error message in classic, but when I switched in lightning interface and testing my trigger it is showing standard error message not showing trigger addError() message.

Please share your experience to resolve my problem

 
Could anyone please help me on below.
How to get sharePoint Rest API to integrate with Salesforce..?

I want to integrate salesforce with Microsoft SharePoint

Thanks 
Nizam 

I want to create person account from pre chat window customer details but getting created business account.

Please help me out my code is below for pre chat window form

<apex:page showHeader="false">

<!-- This script takes the endpoint URL parameter passed from the deployment page and makes it the action for the form -->
<script type='text/javascript'>
(function() {
function handlePageLoad() {
var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)");
document.getElementById('prechatForm').setAttribute('action',
decodeURIComponent(endpointMatcher.exec(document.location.search)[1]));
} if (window.addEventListener) {
window.addEventListener('load', handlePageLoad, false);
} else { window.attachEvent('onload', handlePageLoad, false);
}})();
</script>
<h1>Live Agent Pre-Chat Form</h1>

<!-- Form that gathers information from the chat visitor and sets the values to Live Agent Custom Details used later in the example -->
<form method='post' id='prechatForm'>

    Name: <input type='text' name='liveagent.prechat:AccountName' id='firstName' /><br />
     <!--input type='text' name='liveagent.prechat:ContactLastName' id='lastName' /><br /-->
     <!--input type='text' name='liveagent.prechat:ContactEmail' id='email' /><br /-->
    Phone: <input type='text' name='liveagent.prechat:AccountPhone' id='phone' /><br />
    Issue: <!--input type='text' name='liveagent.prechat:AccountDescription' id='subject' /--><br />

<!-- Hidden fields used to set additional custom details -->
    <input type="hidden" name="liveagent.prechat:AccountDescription" value="New-jkknj" /><br />
    <input type="hidden" name="liveagent.prechat:AccountRecordType" value="012a000000188SM" />
    <input type="hidden" name="liveagent.prechat.name" id="prechat_field_name" />

<!-- map: Use the data from prechat form to map it to the Salesforce record's fields -->
<input type="hidden" name="liveagent.prechat.findorcreate.map:Account" value="Name,AccountName;Phone,AccountPhone;Description,AccountDescription;RecordType,'(!AccountRecordType)'"/><!--,AccountDescription;
<input type="hidden" name="liveagent.prechat.findorcreate.map.doFind:Account" value="Phone,true" />
<input type="hidden" name="liveagent.prechat.findorcreate.map.isExactMatch:Account" value="Phone,true" />
<input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Account" value="Name,true;Phone,true;Description,true;RecordTypeId,True"/><!--;Bill_Street_1__c,true;
LastName,true;IsPersonAccount,true" /-->
<input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Account" value="true" />
<!--input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Case" value="true" /-->

<!-- saveToTranscript: Associates the records found / created, i.e. Contact and Case, to the Live Chat Transcript record. --> 
<input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Account" value="AccountId" />
<input type='submit' value='Chat Now' id='prechat_submit' onclick="setName()"/>

<!-- Set the visitor's name for the agent in the Console to first and last name provided by the customer -->
<script type="text/javascript">
   function setName() {
    document.getElementById("prechat_field_name").value =  
        document.getElementById("firstName").value;
    }
</script>

<style type="text/css">
p {font-weight: bolder }
</style>

</form>

thanks 

nizam

Hi All, I want to get id from parameter in salesforce community into apex controller but not able to get it. I tried to use ApexPages.currentPage().getParameters().get('id') but it is not working 

I want to create person account from pre chat window customer details but getting created business account.

Please help me out my code is below for pre chat window form

<apex:page showHeader="false">

<!-- This script takes the endpoint URL parameter passed from the deployment page and makes it the action for the form -->
<script type='text/javascript'>
(function() {
function handlePageLoad() {
var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)");
document.getElementById('prechatForm').setAttribute('action',
decodeURIComponent(endpointMatcher.exec(document.location.search)[1]));
} if (window.addEventListener) {
window.addEventListener('load', handlePageLoad, false);
} else { window.attachEvent('onload', handlePageLoad, false);
}})();
</script>
<h1>Live Agent Pre-Chat Form</h1>

<!-- Form that gathers information from the chat visitor and sets the values to Live Agent Custom Details used later in the example -->
<form method='post' id='prechatForm'>

    Name: <input type='text' name='liveagent.prechat:AccountName' id='firstName' /><br />
     <!--input type='text' name='liveagent.prechat:ContactLastName' id='lastName' /><br /-->
     <!--input type='text' name='liveagent.prechat:ContactEmail' id='email' /><br /-->
    Phone: <input type='text' name='liveagent.prechat:AccountPhone' id='phone' /><br />
    Issue: <!--input type='text' name='liveagent.prechat:AccountDescription' id='subject' /--><br />

<!-- Hidden fields used to set additional custom details -->
    <input type="hidden" name="liveagent.prechat:AccountDescription" value="New-jkknj" /><br />
    <input type="hidden" name="liveagent.prechat:AccountRecordType" value="012a000000188SM" />
    <input type="hidden" name="liveagent.prechat.name" id="prechat_field_name" />

<!-- map: Use the data from prechat form to map it to the Salesforce record's fields -->
<input type="hidden" name="liveagent.prechat.findorcreate.map:Account" value="Name,AccountName;Phone,AccountPhone;Description,AccountDescription;RecordType,'(!AccountRecordType)'"/><!--,AccountDescription;
<input type="hidden" name="liveagent.prechat.findorcreate.map.doFind:Account" value="Phone,true" />
<input type="hidden" name="liveagent.prechat.findorcreate.map.isExactMatch:Account" value="Phone,true" />
<input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Account" value="Name,true;Phone,true;Description,true;RecordTypeId,True"/><!--;Bill_Street_1__c,true;
LastName,true;IsPersonAccount,true" /-->
<input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Account" value="true" />
<!--input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Case" value="true" /-->

<!-- saveToTranscript: Associates the records found / created, i.e. Contact and Case, to the Live Chat Transcript record. --> 
<input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Account" value="AccountId" />
<input type='submit' value='Chat Now' id='prechat_submit' onclick="setName()"/>

<!-- Set the visitor's name for the agent in the Console to first and last name provided by the customer -->
<script type="text/javascript">
   function setName() {
    document.getElementById("prechat_field_name").value =  
        document.getElementById("firstName").value;
    }
</script>

<style type="text/css">
p {font-weight: bolder }
</style>

</form>

thanks 

nizam