Professional Documents
Culture Documents
Got
Got
Hello, I wrote a trigger to check if the url = 'https://sig-cb--Full.cs88.my.salesforce.com' and the profile of
the current user is a specific profile (SIG-FSM-Super User) and if so the trigger shows an error message
and also an image which I included in the addError function, it looks like this:
view source
print?
02
04
05 system.debug('<<baseURL>>' + baseURL);
09
Contact c = new
10
Contact();
11
14
15 for(Contact c : Trigger.New){
16 if(isBaseURL == TRUE && currentUser.Profile.Name == 'SIG-FSM-Super User'){
c.addError(' <p style="color:red; font-size: 20px;">Service contact creation is only allowed from
“Account” tab using the blue button “Create Contact” after selecting a account”</p><img
17
id="theImage" src="https://sig-cb--full--c.cs88.content.force.com/servlet/servlet.FileDownload?
file=0159E0000002tNp" width="850px" height="100px" alt="Description of image here"/> ', false);
18 }
19
}
20 }
Can anyone help me with how to build the test class for the trigger? At least theoretical.
see more...
Sarah Paulson
Reply
Like
Follow
0
Continue reading or reply
Savita Singh
0 replies
I have saved password in custom object ,now i have to write a batch apex to auto check for passwords of
custom objects.
I have saved password in custom object ,now i have to write a batch apex to auto check for passwords
of records
see more...
Savita Singh
Reply
Like
Follow
Rishabh Bhardwaj
0 replies
Mapping user_id_token in managed package usage summary report with an actual user
I have been working on salesforce API integration for my org which deals with some use cases involving
usage and license reporting. I have been exploring managed package usage summary data for last
couple of days, which basically gives me a high level metric of how managed package are being used in
my org.
The data that is returned right now does not map the usage summary with each user ID, but returns
back a user_id_token which according to the documentation
"The hashed token representing the ID of the user who accessed the custom object. The ID persists over
time, and across any packages that the user interacts with.
The user ID token starts with the prefix 005-"
Looking for help on how I can map this user_id_token with the actual user.
Thanks
see more...
Rishabh Bhardwaj
Reply
Like
·
Follow
MUSFAR KT 6
1 replies
how to use field set in lightning component for form edit and view
how to use fieldset in lightning component for creation of form edit and view in the account object
see more...
MUSFAR KT 6
Reply
Like
Follow
0
Continue reading or reply
Shubham Khajjepawar
0 replies
Shubham Khajjepawar
Reply
Like
Follow
srikanth yeturu 5
3 replies
2.Display list of accounts in a block with checkbox, if the user selects the accounts and click on "Show
Contacts " button the selected account related contacts should display in the pageBlocktable beside the
accounts list block
Right side block should display Account name as a heading and its related contacts under that account
make those changes.
page block 2 is not working ...?
// class
public class AccountSelectClassController {
public AccountSelectClassController ()
{
if(wrapaccountList ==null)
{
wrapaccountList =new list<wrapaccount>();
for(account a:[select id,name from account limit 10])
{
wrapaccountlist.add(new wrapaccount(a));
}
}
}
public void ProcessSelected()
{
selectedAccounts=new list<account>();
selectedrecordsIds =new list<id>();
records =new List<Contact>();
names =new List<Account>();
for(wrapaccount wrapobj:wrapaccountlist)
{
if(wrapobj.isSelected==true)
{
selectedAccounts.add(wrapobj.accn);
}
}
for(Account abc:selectedAccounts)
{
selectedrecordsIds.add(abc.id);
}
names = [SELECT Name,label__c FROM ACCOUNT WHERE Id IN :selectedrecordsIds];
records = [SELECT Name FROM Contact WHERE AccountId IN : selectedrecordsIds];
System.debug('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'+records);
System.debug('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'+selectedrecordsIds);
System.debug('ccccccccccccccccccccccccccccccccccccccc'+names);
}
public class wrapaccount
{
public account accn{get;set;}
public boolean isSelected{get;set;}
public wrapaccount(account a)
{
accn=a;
isselected=false;
}
}
}
vf pafe :-
<apex:page sidebar="false" controller="AccountSelectClassController">
<script type="text/javascript">
function selectAllCheckboxes(obj,receivedInputID){
var inputCheckBox = document.getElementsByTagName("input");
for(var i=0; i<inputCheckBox.length; i++){
if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
inputCheckBox[i].checked = obj.checked;
}
}
}
</script>
<apex:form >
<apex:pageBlock id="block2">
<apex:pageBlockSection columns="2">
<apex:pageBlockTable value="{!wrapaccountList}" var="waccl">
<apex:column >
<apex:facet name="header">
<apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
</apex:facet>
<apex:inputCheckbox value="{!waccl.isSelected}" id="InputId"/>
</apex:column>
<apex:column value="{!waccl.accn.name}"/>
</apex:pageBlockTable>
<apex:pageBlock >
<apex:pageBlockTable value="{!names}" var="aaa">
<apex:column value="{!aaa.Name}" headerValue="name"/>
<apex:pageBlockTable value="{!records}" var="qqq">
<apex:column value="{!qqq.name}"/>
</apex:pageBlockTable>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!ProcessSelected}" value="Show Selected Contacts"
reRender="block2"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
see more...
srikanth yeturu 5
Reply
Like
Follow
Muoi T
0 replies
Improve Data Quality for Your Sales and Support Teams> Create a Validation Rule > "Error message is
not displayed above 'Close Date' field. Check the instructions."
see more...
Muoi T
Reply
Like
Follow
Yogesh Biyani
1 replies
How I insert a related object using the external id field on the parent object?
I have a custom parent object License__c and related object Activation__c which have a
Related_License__c lookup field to the License__c object and the relations ship name is License
Activations.
License__c has l_id__c external id field. I would like to import the Activation__c object using the l_id__c
field so that the parent-child relationship is automatically created.
This works using the data import wizard but fails when I try to import use the Bulk Api 1.0
Activation_Id__c,License_Activations__r.l_id__c
9249,1665029
9250,1665029
see more...
Yogesh Biyani
Reply
Like
Follow
AMRITA P Panda
0 replies
Apex class:-
@AuraEnabled
public static List < sObject > fetchLookUpValues(String searchKeyWord, String ObjectName,
List<sObject> ExcludeitemsList, String UserId)
{
try{
List <Group > Careagentgroup;
List <Group > noncareagentgroup;
String searchKey = '' + searchKeyWord + '%';
List <String> lstOfGroupIds = new List <String> ();
List <Group> lstOfQueue;
List <GroupMember> lstOfSubGroupId;
Set<id> idGroup = new Set<id>();
lstOfSubGroupId = [SELECT GroupId from GroupMember WHERE UserOrGroupId=: UserId LIMIT
500];
if(lstOfSubGroupId.size()>0){
for(GroupMember gm : lstOfSubGroupId){
idGroup.add(gm.GroupId);
}
}
lstOfQueue = [SELECT Id from Group WHERE Id IN (Select Groupid from GroupMember where
userOrGroupId in : idGroup) LIMIT 500];
if(lstOfQueue.size()>0){
for(Group q : lstOfQueue){
lstOfGroupIds.add(q.Id);
}
}
List<string> lstExcludeitems = new List<string>();
for(sObject item : ExcludeitemsList ){
lstExcludeitems.add(item.id);
}
Careagentgroup=[select name from group where name like'care%' AND Name LIKE: searchKey
AND Id NOT IN : lstExcludeitems AND Id NOT IN : lstOfGroupIds];
noncareagentgroup=[select name from group where Name LIKE: searchKey AND (NOT name LIKE
'care%') AND Id NOT IN : lstExcludeitems AND Id NOT IN : lstOfGroupIds];
list<user> u=[select id,name,profile.name from user where id=:UserId];
List <sObject> returnList = new List <sObject> ();
helper :-
({
searchHelper : function(component,event,getInputkeyWord,UserId) {
var action = component.get("c.fetchLookUpValues");
action.setParams({
'searchKeyWord': getInputkeyWord,
'ObjectName' : component.get("v.objectAPIName"),
'ExcludeitemsList' : component.get("v.lstSelectedRecords"),
'UserId' : UserId
});
//String searchKeyWord, String ObjectName, List<sObject> ExcludeitemsList, List<Group> lstofgrp
action.setCallback(this, function(response) {
$A.util.removeClass(component.find("mySpinner"), "slds-show");
var state = response.getState();
console.log("state" + state);
if (state === "SUCCESS") {
var storeResponse = response.getReturnValue();
//console.log("storeResponse-----" +storeResponse[0].Name );
if (storeResponse.length == 0) {
component.set("v.Message", 'No records found');
}
else {
component.set("v.Message", '');
}
component.set("v.listOfSearchRecords", storeResponse);
}
});
$A.enqueueAction(action);
},
})
Question is :- I want to take the values present in the "returnlist" from apex class and compare it in the
helper and based on the comparision will print the message as " not authorized".
see more...
AMRITA P Panda
Reply
Like
Follow
PG 110
0 replies
need to access the logged in user info inside a global variable which can be accessed by javascript.
One of our end customers has a community. We need to access the logged in user info inside a global
variable which can be accessed by javascript. Can this be done? Something along the lines of a hidden
variable which can be stored on the page and accessed in javascript.
Has anyone done this? AN example With and without requiring new code will be super helpful.
Any one has any pointers or articles will be helpful too. Thanks in advance.
see more...
PG 110
Reply
Like
Follow
Sarah Paulson
0 replies
system.debug('<<baseURL>>' + baseURL);
for(Contact c : Trigger.New){
c.addError(' <p style="color:red; font-size: 20px;">Service contact creation is only allowed from
“Account” tab using the blue button “Create Contact” after selecting a account”</p><img id="theImage"
src="https://sig-cb--full--c.cs88.content.force.com/servlet/servlet.FileDownload?
file=0159E0000002tNp" width="850px" height="100px" alt="Description of image here"/> ', false);
Can anyone help me with how to build the test class for the trigger? At least theoretical.
Sarah Paulson
Reply
Like
Follow
Savita Singh
0 replies
I have saved password in custom object ,now i have to write a batch apex to auto check for passwords of
custom objects.
I have saved password in custom object ,now i have to write a batch apex to auto check for passwords
of records
see more...
Savita Singh
·
Reply
Like
Follow
Rishabh Bhardwaj
0 replies
Mapping user_id_token in managed package usage summary report with an actual user
I have been working on salesforce API integration for my org which deals with some use cases involving
usage and license reporting. I have been exploring managed package usage summary data for last
couple of days, which basically gives me a high level metric of how managed package are being used in
my org.
The data that is returned right now does not map the usage summary with each user ID, but returns
back a user_id_token which according to the documentation
"The hashed token representing the ID of the user who accessed the custom object. The ID persists over
time, and across any packages that the user interacts with.
The user ID token starts with the prefix 005-"
Looking for help on how I can map this user_id_token with the actual user.
Thanks
see more...
Rishabh Bhardwaj
Reply
Like