Header Ads Widget

webservice method call from custom button || INTERVIEW QUESTIONS AND ANSWERS

web service method call from custom button
email masking in sandbox



Technical Requirement:
We have enhancement request in our project and requirements are select number of records in View and change the owner of the selected record.
Description:
As above technical requirement we want to create action from Button and update the records.
Steps to solve above requirement:
1. Create Custom button or Link Named Assign and behavior execute JavaScript.
Code on button:
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")} // declare the Js connection
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")} // declare the Js apex
{!REQUIRESCRIPT("/js/dojo/0.4.1/dojo.js")} // declare the Js dojo
var ids='';
for(j=0;j< document.forms.length;j++)
{
for (i = 0;i
{
if((document.forms[j].elements[i].name=='ids') && document.forms[j].elements[i].checked)
{
ids+=document.forms[j].elements[i].value+',';
}
}
}// end of loop
if(ids==''){
alert('No requests selected !!!');
}else{
var returnFlag = '';
returnFlag = sforce.apex.execute("CheckClass" , "methode ", {ids:ids} );
if(returnFlag== ‘true’){
window.location = '/apex/PageName;
}else if(returnFlag== ‘false){
alert('You do not have permission to do this!')
}
--------------End of Code--------------------
2. Apex class:
global class CheckClass{
WebService static Boolean methode(){
Write the Logic
Return Boolean value
}
}

Email Masking in Sandbox
Technical Requirement:
Post of Salesforce Developer or Tester getting requirement on Email masking. Email masking is nothing but append the text to email in Sandbox.
Description:
Every Salesforce project’s has the Sandbox environment which is the copy of Production. Which contains all the records of objects like Account and there record like number of records created in Production. These numbers of records are very high means thousands and lacks records. So at the time of Sandbox activation it will copy all records of data from production to Sandbox.
Sandbox is the test environment where Salesforce developer could do something. However before working in Sandbox we need to do mask the email fields of different object. Email field contains the original email id of users and when Salesforce developer work on this sandbox user will get email.
So we need to append the text into email field of Account, Contact, Lead, Opportunity etc objects. Like email@company.com so after email masking it will email@company.com.testfix. Issue is number of records are too large and we can not do easily. For that we need Data Loader and Salesforce Explorer tools.
Solution:
Following are steps to solve the email masking task:
1.            We have to fetch the records from sandbox where emails id contains ‘.com’ text according to Object. We have created SOQL and use this SOQL in data loader.
SOQL:
Select Id, Email FROM Lead where Email!=null and ( email like '%a' or email like '%b' or email like '%c' or email like '%d' or email like '%e' or email like '%f' or email like '%h' or email like '%i' or email like '%j' or email like '%k' or email like '%l' or email like '%m' or email like '%n' or email like '%o' or email like '%p' or email like '%q' or email like '%r' or email like '%s' or email like '%t' or email like '%u' or email like '%v' or email like '%w' or email like '%g' or email like '%y' or email like '%z' )
Description of above SOQL:
We are fetching records Id and Email from Lead object those email not end with ‘x’. Like email@company.com.testfix contains ‘x’ so it will return which is not masked with ‘.testfix’ and this above SOQL run in to Data Loader.
After getting records in csv format open the file.
2.            Open the downloaded CSV file if file size is more than lack than use FILE SPLITTER tool in to CVS file.
Open CSV file and add below formula on second of email column. Like Column A is Email column then after B column use C column.
Formula: =IF(B2 <> C2,CONCATENATE(B2,".testfix")," ")
Copy this cell to last cell means copy this value of cell and past to end to column.
After doing above step copy the column of masked and Past Specials than select values.
Delete the Email column make sure new column should be masked.
3.            After above steps update this CSV file to Data Loader with selection on LEAD object.
4.            Open Salesforce Explorer and again fire above SOQL.
Conclusion:
We could do email masking using above steps.

Post a Comment

0 Comments