• Salesforce Blitz
  • NEWBIE
  • 90 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 58
    Questions
  • 58
    Replies
Is it possible to verify when a profile/class has been added/removed from class/profile if they are part of Change Set. Any other specific object which saves this data.

I observed that few profiles had permissions to few apex classes. It went missing after deploying ChangeSet. This CS didnt have those profiles for which the permissions went missing.
I am reading csv string and placing the values into appropriate fields in Salesforce Objects.
But for below scenario I am facing error:

Consider csv Line has 123,56,124,45,45,2548,3356 --this works fine with 6 columns into 6 fields
If Input has string/comma like 123,56,124,45,45,"2,548","3,356" We are getting an error of invalid integer "2 

Need to merge data between two "" into one without spaces just like the former
Assume VP-->Lead-->Rep hierarchy structure.
Owner may be Lead/Rep. Need to get details of VP for both of them.
If owner is Rep---Need the user in VP(2 levels up)(assuming only one user per role VP wise as set in org).
If Owner is Lead---Need the user in VP(1 level up)(assuming only one user per role VP wise as set in org)

Please find below code 

public static set<Id> getSubordinateRoles(Id roleId) {
    map<Id, set<Id>> parentAndChildren = new map<Id, set<Id>>();
    set<Id> children;
    for(UserRole ur : [select Id, ParentRoleId from UserRole]) {
        children = parentAndChildren.containsKey(ur.ParentRoleId) ? parentAndChildren.get(ur.ParentRoleId) : new set<Id>();
        children.add(ur.Id);
        parentAndChildren.put(ur.ParentRoleId, children);
    }
    return getSubordinateRoles(roleId, parentAndChildren);
}

Any help would be appreciable
I have created a Event Staging object and a trigger which creates Events/Event Relations after insert of an Event Staging record.
There is a field meetingUID on EventStaging.It is not set set to unique in SF.However if a duplicate field with same meetingUID value is inserted into object, it should fetch and update the original Event Staging object record.
How to achieve this? I am trying in before insert trigger the below code. However a new record gets created every time which leads to record duplication.
Any help appreciated.

 
Public class EventnEventRelation 
{
    Set<string> userset=new set<string>();
    Set<string> EventcreatedBy=new set<string>();
    Set<string> EventMeetingUID=new set<string>();
    List<user> userlist=new List<user>();
    map<string,id> map1=new map<string,id>();
    map<string,string> map2=new map<string,string>();
    map<string,Sobject> map3=new map<string,Sobject>();
    List<Event_Staging__c> userlist1 =new List<Event_Staging__c>();
    List<event> eventlist=new list<event>();
    List<eventrelation> eventrelationlist=new list<eventrelation>();
    List<eventrelation> maineventrelationlist=new list<eventrelation>();
    List<Event_Staging__c > oldeventrelationlist=new list<Event_Staging__c >();
    List<Event_Staging__c > Evstagelist = new List<Event_Staging__c >();
    Set< String > MeetingUidSet = new Set< String >();
    public sObject sobj{get;set;}



    Public EventnEventRelation()
    {
    //Set<string> userset=new set<string>();
    //fetch list of all active Users
    userlist=[Select id,Name,Email from User where IsActive = true];
    //Create a map of emailId and ID of users
    //map<string,id> map1=new map<string,id>();
    for(user us:userlist)
    {
        map1.put(us.email,us.id);
    }

    userlist1=[Select Event_Created_By__c,Meeting_UID__c,Event_Attendees__c,Event_CC__c FROM Event_Staging__c];
    //Create map of meetingUID and eventattendeed of eventstaging
    //map<string,string> map2=new map<string,string>();
    for( Event_Staging__c  Evs1:userlist1)
    {
        map2.put(Evs1.Meeting_UID__c,Evs1.Event_Attendees__c+';'+Evs1.Event_CC__c);
        EventcreatedBy.add(Evs1.Event_Created_By__c);
        EventMeetingUID.add(Evs1.Meeting_UID__c);
        //map3.put(Evs1.Meeting_UID__c,Evs1.id);
    }        

    for(User Uu:userlist)
    {
    userset.add(uu.Email);
    }
    //userset.addall(userlist);

    }

    Public void EventmethodBefore(List<Event_Staging__c> ESList)
    {

        for( Event_Staging__c ec : ESList ) MeetingUidSet.add(ec.Meeting_UID__c);
        for( Event_Staging__c  Evss:[Select Id,Meeting_UID__c FROM Event_Staging__c WHERE Meeting_UID__c=:MeetingUidSet])
        map3.put(Evss.Meeting_UID__c,Evss);

        for( Event_Staging__c ec : ESList )
        {
            sobj = map3.get(ec.Meeting_UID__c);
            If(sobj !=NULL)
            {
                sobj.put('Name', ec.Name);
                sobj.put('Event_Attendees__c', ec.Event_Attendees__c);
                sobj.put('Event_Attendees__c', ec.Event_Attendees__c);
                sobj.put('Event_CC__c', ec.Event_CC__c);
                sobj.put('Event_Start_Date__c', ec.Event_Start_Date__c);
                sobj.put('Event_End_Date__c', ec.Event_End_Date__c);
                sobj.put('Event_Duration_in_Minutes__c', ec.Event_Duration_in_Minutes__c);
                sobj.put('Event_Location__c', ec.Event_Location__c);
                sobj.put('Meeting_UID__c', ec.Meeting_UID__c);
                sobj.put('Event_Description__c', ec.Event_Description__c);


            }
        }
    }   



      Public void Eventmethod(List<Event_Staging__c> ESList)
    //Public void Eventmethod(List<Event_Staging__c> ESList)
    {  
    For(Event_Staging__c ES: ESList)
        {

            If(userset.contains(ES.Event_Created_By__c) )
            {
                Event ev = new Event();
                Id Id1=map1.get(ES.Event_Created_By__c);
                ev.ownerId=Id1;
                system.debug('Event created By'+id1);
                ev.Subject=ES.Name;
                ev.Location=ES.Event_Location__c;
                ev.StartDateTime=ES.Event_Start_Date__c;
                ev.EndDateTime=ES.Event_End_Date__c;
                ev.Description=ES.Meeting_UID__c;
                ev.DurationInMinutes=ES.Event_Duration_in_Minutes__c.intvalue();
                eventlist.add(ev);



            }
            else
            {
                Event ev1 = new Event();
                ev1.ownerId=UserInfo.getUserId();
                ev1.Subject=ES.Name;
                //ev1.setEventWhoIds();
                ev1.Location=ES.Event_Location__c;
                ev1.StartDateTime=ES.Event_Start_Date__c;
                ev1.EndDateTime=ES.Event_End_Date__c;
                ev1.Description=ES.Meeting_UID__c;
                ev1.DurationInMinutes=ES.Event_Duration_in_Minutes__c.intvalue();
                eventlist.add(ev1);

            }

        //}
        }

        if(eventlist.size()>0 && eventlist!=NULL)
        {
            system.debug('Eventlist Size------'+eventlist.size());
            insert eventlist;
            system.debug('Eventlist Size------'+eventlist[0]);
            system.debug('Eventlist Size------'+eventlist[0].subject);
        }
        set<string> set3=new set<string>();
        List<Event_Staging__c> UpdateEventstaging = new list<Event_Staging__c>();
        for(Event ECB : eventlist)
        {
            set3.add(ECB.description);
        }

        for(Event_Staging__c  EVSCB :[select id,name,Meeting_UID__c FROM Event_Staging__c] )
        {
            If(set3.contains(EVSCB.Meeting_UID__c))
            {
                EVSCB.IsEventCreated__c=TRUE;
                UpdateEventstaging.add(EVSCB);
            }
        }
        If(UpdateEventstaging.size()>0 && UpdateEventstaging!=NULL)
        {
            update UpdateEventstaging;
        }



        for(event ev:eventlist)
        {
                //List<String> ReciepientMail= EVS.Event_Attendees__c.split(',');
                string str=map2.get(ev.Description);
                system.debug('Map1 size---------'+map1.size());
                system.debug('Map2 size---------'+map2.size());
                system.debug('string --------'+str);

                List<String> ReciepientMail= str.split(';');
                for(integer i=0;i<ReciepientMail.size();i++)
                {
                    If(userset.contains(ReciepientMail[i]))
                    {
                    eventrelation evr=new eventrelation();
                    evr.eventid=ev.Id;
                    evr.relationid=map1.get(ReciepientMail[i]);
                    evr.status='New';
                    evr.respondeddate=datetime.now();
                    eventrelationlist.add(evr);
                    //maineventrelationlist.addall(eventrelationlist);
                    //eventrelationlist.clear();
                    }
                }
                maineventrelationlist.addall(eventrelationlist);
                eventrelationlist.clear();




        }

       if(maineventrelationlist.size()>0 && maineventrelationlist!=NULL)
        {
             insert maineventrelationlist;
        }
        //delete [select id from Event_Staging__c where id in :Trigger.new];

    }

    Public void DeleteOldEventStagings()
    {
        List<Event_Staging__c > DelList=new List<Event_Staging__c>();
        DelList=[Select Id,name from Event_Staging__c where IsEventCreated__c=FALSE AND CreatedDate <= LAST_N_DAYS:01 ];
        Delete DelList;
    }

}



 
I have a field named recepient which contains both Salesforce users and Non salesforce users EMAIL IDS.
I need to SOQL to find the User Ids of Salesforce Users and exclude the Non Salesfoerce users.

How do I need to achieve this
Created a staging object similar to Event.
Have FROM and TO emailID's of salesforce users loaded from outlook into SF Staging Object fields through DataLoader CLI.

Ex:
Staging Object name: Event Staging
Fields:From,To,Date,Duration,Subject,Location...

FROM(field type:email) field will have single email id,
TO(field type:Text) field will have multiple email ids.

Once a record is created in Event staging, FROM field(Salesforce users email ex:sridher.sharma@apple.com) need to fetch UserID(15 digit SF ID of user) and needs to create a Single Event record with details(Date,Duration,Subject,Location...). 
As soon as the Event is created,the Event ID will be generated. 
The TO field(Salesforce Users email) needs to fetch userID and create multiple Event relation records mapped to above created Event (based on number of emailID's in To).

Could someone help me in the way as how to approach the coding part.


Thanks & regards
 
I have a Workflow which sends email link of record to set of users when Opportunity probability >=70.
I have OWD set to private.
So the users are facing insufficient privilages error when clicking n the link.
Any alternative way of achieveing this.Need to display record to the email recepient.
(Big Deal Alert doesn't suit our requirement as we have VF pages over riding the PageLayouts).

Any help/suggestion appreciated.


Thanks
I have replaced the New View and Edit buttons of my Opportunity with VF page.
Now I am creating BIG Deal Alert, where I need to provide "Use Page Layout and Language From" of User with View All data permission.
I have assigned a system admin profile but receiving blank email with proper subject.
How can I make change so that i can display the VF page in my email.
I tried including VF page in PageLayout and assigning to profile,but it doesnt work as expected.
Any help is appreciated..
Thanks..!!
I need to retrieve the record owners manager name and manager email in merge field in a email template.
How is it possible..
I have the option of creating 2 fields on object and updating using the workflow..But I need to create 2 fields and hide them n page layout .

Simply I need to retrieve and display in a email template using merge field.

Any immediate help appreciated.
 
I have created a site and set a workflow email alert to send a email with link to contact email 15 days after CONTACT Created date.
The link is working fine, but i am not able to create the record in Salsforce Custom object.

The VF page which i included in SITE's Active Site Home Page is working well and creating Salesforce record internally..However through sites. when customer fills the survey no record is created,



is there anyhthing I need to do in addition to this for the record to be created.??

Thanks in advance,
Laxman 
I need to display all contact records in a picklist in a flow.
On selection of 1 record, I need to ask few survey questions and save it to a custom object.

How to achieve this.How to display all records in picklist,Is it possible??

Thanks
​Laxman
I need to display all account records in a picklist in a flow.
On selection of 1 record, I need to ask few survey questions and save it to a custom object.

How to achieve this.How to display all records in picklist,Is it possible??

Thanks
Laxman
I have a user, who has a different as head in role hierarchy.

I need to fetch the parent user name of given user

Thanks
How do i need to fetch record name from record id in salesforce


Thanks
Laxman
Public void mymethod(set<id> subord1,map<id,user> usersMap)
    {
for(id subid :subord1)
           {
             Id roleId=usersMap.get(subid).userRoleId; 
             user u1=usersMap.get(subid);
              List<user> users;
             
             if(roleId!=null)
             {
             users = [select Id from User where UserRoleId IN (select Id from UserRole where ParentRoleId = :roleId)];
             }
}
}

I want to move the SOQL out of for loop---Or change it into single SOQL.


Thanks in adv.
Laxman 
I have created a custom VF dashboard to display the dashboard.

I have created multiple components(tables/bar chart/pie), however the look and feeel is different.

How to make the look and feel similar to standard saledforce using CSS..??

Any help please
Hi guys,urgent help needed here..

I have a VF page which display multiple tables(10 tables) just like a dashboard. and a custom controller

I have a picklist at top of page which displays names of available users.

When I change the user in VF page, the tables should display data only which are visible to the user selected.

Any idea of how to achieve this?
HI,

I have <apex:selectoption> in VF which displays list of users.

My requirement is, on change of user, i need to pass the ID of the user to controller and do some SOQL in couple of methods of controller code and refresh the VF page.

How should this be done.

Thanks in Advance
Hi.

I have created a visual dashboard in salesforce along with a filter at top which displays names of users.

I need the dashboard to be changed when the user is changed in dropdown.


How to achieve this.


CONTROLLER:
<apex:page controller="TopFiveOpenDeals" tabStyle="Opportunity">
    <apex:form >
    <apex:selectList label="Users" multiselect="false" size="1">
            <apex:actionSupport event="onchange" action="{!UpdateSelectedFirstItem}" rerender="page"  />
            <apex:selectOptions value="{!owner_list}"></apex:selectOptions>
    </apex:selectList>
    </apex:form>
    
    <apex:panelGrid columns="2" width="20">
    
    <apex:chart height="250" width="450" animate="true" data="{!gaugedata}">
    <apex:axis type="Gauge" position="gauge" title="Sum Of TCV"
        minimum="0" maximum="1500000" steps="10"/>
    <apex:gaugeSeries dataField="data1" donut="50" colorSet="#78c953,#ddd"/>
    </apex:chart>

    <apex:pageBlock title="Top 5 Open Deals" >
        <apex:pageBlockSection columns="2" >
        <apex:pageBlockTable value="{!opps}" var="opp">
            <apex:column value="{!opp.Name}"/>
            <apex:column value="{!opp.Total_TCV__c}"/>
        </apex:pageBlockTable>
        </apex:pageBlockSection>
    </apex:pageBlock>   
   </apex:panelGrid>
</apex:page>


PAGE:
public with sharing class TopFiveOpenDeals {

  List<String> nameList{get;set;}
  List<selectOption> owner_List{get;set;}
  List<User> ownerList{get;set;}

  Public TopFiveOpenDeals()
  { 
         ownerList=new List<User>();
         ownerList=[Select Id, Name From User where isActive=true AND Profile.name='System Administrator'];
         //ownerList=[Select Id, Name From User where isActive=true AND Profile.name='Sales User' AND UserRole.name LIKE '%Sales%'];
         nameList=new List<String>();
         owner_List=new List<selectOption>();
        for(User a:ownerList)
        {
            nameList.add(a.name);
        }
        
        
         }
   public List<SelectOption> getOwner_list()
   {
     for(String obj:nameList)
     {
         owner_List.add(new selectOption(obj,obj));
     }  
   
      return owner_list;
   }
  
  public void UpdateSelectedFirstItem()
    {
   
     }

  public List<Opportunity> getOpps() {
    return [ Select Name,Total_TCV__c 
      from Opportunity 
      //WHERE Total_TCV__c !=NULL AND (CloseDate= THIS_QUARTER OR CloseDate=NEXT_QUARTER)  
      WHERE Total_TCV__c !=NULL
      ORDER BY Total_TCV__c 
      DESC LIMIT 5
    ];
  }
}


Thanks,
Laxman 
Hi guys,

I have custom opportunity field named Total_Amount__c.
I need to get Top 5 accounts with opportunities based on Total Amount.
Need to code above(not in reports)

Note: Consider if an account have 5 opps, then the sum of 5 opp fields need to be taken into consideration.


Thanks in advance,
 
I have created a custom VF dashboard to display the dashboard.

I have created multiple components(tables/bar chart/pie), however the look and feeel is different.

How to make the look and feel similar to standard saledforce using CSS..??

Any help please
Is it possible to verify when a profile/class has been added/removed from class/profile if they are part of Change Set. Any other specific object which saves this data.

I observed that few profiles had permissions to few apex classes. It went missing after deploying ChangeSet. This CS didnt have those profiles for which the permissions went missing.
Hi, I'm trying to make a REST API call at:

https://....salesforce.com/services/apexrest/...

but I'm getting this error:

{'message': 'You do not have access to the Apex class named: OutboundInterfaceRunRestService', 'errorCode': 'FORBIDDEN'}

It works if I use an admin user, but not with another user. What permissions should I give this user?
 
I am reading csv string and placing the values into appropriate fields in Salesforce Objects.
But for below scenario I am facing error:

Consider csv Line has 123,56,124,45,45,2548,3356 --this works fine with 6 columns into 6 fields
If Input has string/comma like 123,56,124,45,45,"2,548","3,356" We are getting an error of invalid integer "2 

Need to merge data between two "" into one without spaces just like the former
I have a field named recepient which contains both Salesforce users and Non salesforce users EMAIL IDS.
I need to SOQL to find the User Ids of Salesforce Users and exclude the Non Salesfoerce users.

How do I need to achieve this
The Big Deal Alert doesn't work well for our organization so we want to create a visualforce email template that mirrors the Big Deal Alert format and a workflow trigger to set it off. Does anybody know if it's possible to create a VF email template that only pulls opportunity detail as well as opportunity owner split?
I have created a site and set a workflow email alert to send a email with link to contact email 15 days after CONTACT Created date.
The link is working fine, but i am not able to create the record in Salsforce Custom object.

The VF page which i included in SITE's Active Site Home Page is working well and creating Salesforce record internally..However through sites. when customer fills the survey no record is created,



is there anyhthing I need to do in addition to this for the record to be created.??

Thanks in advance,
Laxman 
I have a user, who has a different as head in role hierarchy.

I need to fetch the parent user name of given user

Thanks
How do i need to fetch record name from record id in salesforce


Thanks
Laxman
Public void mymethod(set<id> subord1,map<id,user> usersMap)
    {
for(id subid :subord1)
           {
             Id roleId=usersMap.get(subid).userRoleId; 
             user u1=usersMap.get(subid);
              List<user> users;
             
             if(roleId!=null)
             {
             users = [select Id from User where UserRoleId IN (select Id from UserRole where ParentRoleId = :roleId)];
             }
}
}

I want to move the SOQL out of for loop---Or change it into single SOQL.


Thanks in adv.
Laxman 
HI,

I have <apex:selectoption> in VF which displays list of users.

My requirement is, on change of user, i need to pass the ID of the user to controller and do some SOQL in couple of methods of controller code and refresh the VF page.

How should this be done.

Thanks in Advance
Hi.

I have created a visual dashboard in salesforce along with a filter at top which displays names of users.

I need the dashboard to be changed when the user is changed in dropdown.


How to achieve this.


CONTROLLER:
<apex:page controller="TopFiveOpenDeals" tabStyle="Opportunity">
    <apex:form >
    <apex:selectList label="Users" multiselect="false" size="1">
            <apex:actionSupport event="onchange" action="{!UpdateSelectedFirstItem}" rerender="page"  />
            <apex:selectOptions value="{!owner_list}"></apex:selectOptions>
    </apex:selectList>
    </apex:form>
    
    <apex:panelGrid columns="2" width="20">
    
    <apex:chart height="250" width="450" animate="true" data="{!gaugedata}">
    <apex:axis type="Gauge" position="gauge" title="Sum Of TCV"
        minimum="0" maximum="1500000" steps="10"/>
    <apex:gaugeSeries dataField="data1" donut="50" colorSet="#78c953,#ddd"/>
    </apex:chart>

    <apex:pageBlock title="Top 5 Open Deals" >
        <apex:pageBlockSection columns="2" >
        <apex:pageBlockTable value="{!opps}" var="opp">
            <apex:column value="{!opp.Name}"/>
            <apex:column value="{!opp.Total_TCV__c}"/>
        </apex:pageBlockTable>
        </apex:pageBlockSection>
    </apex:pageBlock>   
   </apex:panelGrid>
</apex:page>


PAGE:
public with sharing class TopFiveOpenDeals {

  List<String> nameList{get;set;}
  List<selectOption> owner_List{get;set;}
  List<User> ownerList{get;set;}

  Public TopFiveOpenDeals()
  { 
         ownerList=new List<User>();
         ownerList=[Select Id, Name From User where isActive=true AND Profile.name='System Administrator'];
         //ownerList=[Select Id, Name From User where isActive=true AND Profile.name='Sales User' AND UserRole.name LIKE '%Sales%'];
         nameList=new List<String>();
         owner_List=new List<selectOption>();
        for(User a:ownerList)
        {
            nameList.add(a.name);
        }
        
        
         }
   public List<SelectOption> getOwner_list()
   {
     for(String obj:nameList)
     {
         owner_List.add(new selectOption(obj,obj));
     }  
   
      return owner_list;
   }
  
  public void UpdateSelectedFirstItem()
    {
   
     }

  public List<Opportunity> getOpps() {
    return [ Select Name,Total_TCV__c 
      from Opportunity 
      //WHERE Total_TCV__c !=NULL AND (CloseDate= THIS_QUARTER OR CloseDate=NEXT_QUARTER)  
      WHERE Total_TCV__c !=NULL
      ORDER BY Total_TCV__c 
      DESC LIMIT 5
    ];
  }
}


Thanks,
Laxman 
Hello,

we are facing the issue that the big deal alerts we have configured in salesforce are no longer showing body text within the emails since our production org has been updated to winter '16 over the weekend. Is anybody else facing the issue or has an idea how to resolve it?
I tried dis- and reabling the big deal alerts without success and have no other solution than building a custom workflow instead of using the big deal alert feature itself.
The layout of the email body of the big deal alerts has been pretty broken before already but at least the relevant data was shown.

Thanks for any help!

Best,
Franz
I have a requirment to create a service which takes input as a user ( userid) and the service needs to return the list of Accounts the user has access to. The user can get access to account  to all possible ways that salesforce can provide (Sharing rules, Role Hierharchies, Record Ownership, Account Team etc...).

I looked around on AccountShare object, GroupMember, UserRecordAcess, Role  object. but could not really connect all the dots together to come up with logic to accomplish this.

USerRecordAccess has the details but you have to provide the USerid and Recordid in order to pull the records which does not fit my requirment.

Looking for any guidance.

Hey,

 

Basically my plan is to create a simple object with maybe even 5 fields. One of these fields will either be a number field or a picklist field (numbered 1-10). A visualforce page is created for the object with the number/picklist depicted as a slider. The goal is to have this survey sent to clients and then once they fill it out, it will insert itself into their account? 

How would I go about doing this?

I have tried very hard to get the slider bar working, there are many many people that have posted how to do it but I can not seem to get it working? I do not know if I am uploading J querry wrong or if I am not altering it well enough?

 

Please help

 

Mikie

Is there a way to hide some opportunities from the related account owner.

 

Ex : Account1 - owner is John

        Opty 1 - owner is John

        Opty 2 - owner is Mike

 

Can we hide opty2  from John?

 

Thanks in Advance.