• Sachii
  • NEWBIE
  • 5 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 16
    Replies

How to get sObject type from the Id?

 

I dont want to use the SOSL query approach or the exception handling approach. Is there any other straight forward way  I can get the API name of the object if i pass the Id?

 

I attempted something like below

 

If(Account.sObjectType==new sObject (sId).getsObjectType())

 

expecting new sObject (sId).getsObjectType() to return Account.sObjectType if 'sId'  belongs to an accoun record.

 

Please help and share your experience when you encountered similar situation.

 

 

~Sachi

  • August 31, 2011
  • Like
  • 0

Hi All,

 

I have included a homepage component with Javascript to have dynamic manipulation of few fields of an object. Below is the script. But after inclusion of this component in the home page layout, related-list hover links are not getting loaded. Also none of the list views displays anything. The list views shows 'loading..' in the left bottom of its frame and its struck there. Does my code have anything that stops sfdc features to work as expected.

 

 

<br> <script>
function callMeNow(){

    var contactNotFound =parent.document.getElementById('00NP0000000XXXX');
    var contactNotFoundDetail =parent.document.getElementById('00NP0000000XXXX_ilecell');
    if(contactNotFound != null){
        contactNotFound.outerHTML="<a href=\"\/003\/e\?nooverride=1\&retURL=\/a0F\/o\" target=\"_blank\"> Click Here To Create New<\/a>";
    }
    if(contactNotFoundDetail != null){
        contactNotFoundDetail.innerHTML="<a href=\"\/003\/e\?nooverride=1\&retURL=\/a0F\/o\" target=\"_blank\"> Click Here To Create New<\/a>";
    }

    return true;
}

window.parent.onload=function(){
    if((window.parent.location.href.indexOf("/a0F")>0 || window.parent.location.href.indexOf("%2Fa0F")>0)){
        callMeNow();
    }
    return true;
}

</script>

Hi,

      I am trying to render a VF as MS excel file with formattings like adding a logo into header, orientation:landscape, and with page breaks.

 

 

<head>  
       <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <style type="text/css">            
            @page
            {    
              size:landscape;
              mso-page-orientation:landscape;    
              mso-header-data:"&amp;[http://www.google.com/images/logos/ps_logo2.png";
              mso-footer-data: "Page &amp;P of &amp;N ";
              margin:.3in .3in .3in .3in;
              mso-header-margin:.18in;
              mso-footer-margin:.20in;          
            }
        </style>
        
    </head>

 

 

But nothing works except footer. If anyone has any solutions, Kindly help me. 

 

P.S: My requirement demands to render only as excel and not as PDF

  • October 28, 2010
  • Like
  • 0

Hi all,

 

I want to customize "Show" picklist in viewing report, so "Show" picklist only contains for example "My Opportunities", I want to remove other picklist values in "Show" picklist in viewing report... Are there any ways for my case?

Any suggestions would be great..

Thanks..

Seems like a simple question, but I can't see where this is set.

 

I created a custom object, Account Thing, which is related to Accounts with a Master-Detail relationship.

It has a text area field, Body.

 

It has a Search Results Layout, and if i search for something contained in Body, a result returns.

 

I created another analogous custom object, Contact Thing.  It also has a text area field, Body.

 

It does not have a Search Results Layout.  If i search for something contained in Body, nothing returns.

 

I'm thinking there must be a flag or search setting that i set for Account Thing, but I can't find it now.

 

Any help is appriciated!

 

 

New to the Community.  Hello!

 

I can't seem to find any documentation as to what happens if a user logs in at 4:30 pm and OWD for login hours is set to  5:00 pm.  If the user is still logged in at 5:01 p.m., what happens?  

 

Can't seem to find the answer anywhere.  Thank you in advance!

Hi,

 

Initially Company "Role Hirarchy" is defined and "Forecast" enabled then Sales targets are assigned monthwise.

after couple of months one Sales Rep reporting is changed to other Manager. Now my company SVP wants to see that Sales managers Forecast based reporting of that Sales Rep based time of actual work reporing, now earlier actuals(Achieved or Opportunity amount) should rollup to first manager and later should rollup to present Sales Manager.

 

Pls provide information that is there any solutions.

 

 

 

Rgds,

Buss

  • January 24, 2012
  • Like
  • 0

Hi,

 

I am having a scenario where I have to populate the value of a field through WF.

There a two fields on the Contact: Contact ID Auto (an Auto Number field) and Contact ID(Text field).

The scenario is:

If 'Contact ID' field is Null, populate it with the value of 'Contact ID Auto' field.

I have created a WF (Evaluation Criteria: Only when a record is created) which checks for the 'Contact ID =Null' and populate its value with 'Contact ID Auto'.

 

 

Issue: Sometimes the WF works fine and populate the correct value while sometimes 'Contact ID' field remains blank.

Is there any time difference in 'value getting updated in auto Number field' and 'the Execution of WF'?

 

Please suggest.

 

Thanks in advance.

 

 

 

Hi,

 

 

Is there any easy way to check which profiles have not any user assigned. the same with the role hierarchy?

 

 

Thanks!

  • January 13, 2012
  • Like
  • 0

How to get sObject type from the Id?

 

I dont want to use the SOSL query approach or the exception handling approach. Is there any other straight forward way  I can get the API name of the object if i pass the Id?

 

I attempted something like below

 

If(Account.sObjectType==new sObject (sId).getsObjectType())

 

expecting new sObject (sId).getsObjectType() to return Account.sObjectType if 'sId'  belongs to an accoun record.

 

Please help and share your experience when you encountered similar situation.

 

 

~Sachi

  • August 31, 2011
  • Like
  • 0

hi friends,

i am using visualforce page and apex class to create standard user and to view user record as well as for edit functionality...

 

i haven't used <apex:detail/> to view record of any particular user...because by using this i am going to standard look and feel...

insted of using detail i have used simple vf  and in that used outputfield to dislay users record

 

here is my code..

 

 

i want to use a command button for reset password ,i haven't written any code in method(reset) of extension ...

how method will be written in extension (say method in extesnion  is reset)

<apex:page standardController="User" tabStyle="MyAdmin__tab" extensions="StaffandUserDetailPageExtension" >  <!--  <apex:detail title="false" relatedList="false"/> -->
    <apex:form >
        <apex:pageBlock mode="edit">
        <apex:pageMessages />
            <apex:pageBlockButtons >
                   
                    <apex:commandButton action="/apex/EditStaffAndUser?id={!id}" value="Edit"/>
                    <apex:commandButton action="/apex/AdminListView?intFocus=5" value="List View"></apex:commandButton>
                <!--    <apex:commandButton action="{!resetpassword}" value="Reset Password"/> -->
                    
                 </apex:pageBlockButtons>
              
              <apex:pageBlockSection title="User Information" columns="2" collapsible="false"> 
             
           
                 <apex:outputField value="{!User.User_Types__c}"/> 
                  <apex:pageBlockSectionItem >
                         <apex:outputLabel value="Active"/>
                         <apex:outputfield value="{!User.IsActive}"/>
                  </apex:pageBlockSectionItem> 
                
                  <apex:outputField value="{!User.ProfileId}"/>
                  <apex:outputField value="{!User.FirstName}"/>
                  <apex:outputField value="{!User.Username}"/>
                  <apex:outputField value="{!User.LastName}"/>
                  <apex:outputField value="{!User.Email}"/>
                  <apex:outputField value="{!User.alias}"/>
                  <apex:outputField value="{!User.CommunityNickName}"/>
     
                  
                 
                  </apex:pageBlockSection>
        
            
           
            

          
                    
                    
            <apex:pageBlockSection >

                  
                   
                   <apex:outputField value="{!User.Phone}"/>
                   <apex:outputField value="{!User.Extension}"/>
                   <apex:outputField value="{!User.Fax}"/>
           
                   <apex:outputField value="{!User.Title}"/>
                   <apex:outputField value="{!User.CompanyName}"/>
          
                   <apex:outputField value="{!User.Department}"/>
                   

         
                   
          
                   </apex:pageBlocksection>
              
              
            
      
      
          
            <!-- 
               <apex:pageBlockSection title="Other Information" columns="1" collapsible="false">
                   <apex:outputField value="{!User.EmailEncodingKey}"/>
                   <apex:outputField value="{!User.TimeZoneSidKey}"/> 
                   <apex:outputField value="{!User.LocaleSidKey}"/>
                   <apex:outputField value="{!User.LanguageLocaleKey}"/>
               </apex:pageBlockSection>
             --> 
               
        
            
              </apex:pageBlock>
              </apex:form>
   
  
 
 
 


   
</apex:page>

 Thanks in advance

Hi,

 

I have written one trigger where new user starts following chatter group automatically without pressing follow button.

but when I try to insert/ upsert records in the trigger an error comes 

shows  "INVALID_CROSS_REFERENCE_KEY, You cannot follow a collaboration group.: []"

 

Sample code

 

EntitySubscription e = new EntitySubscription();   

e.subscriberId = '005E0000000VP6hIAG';             

e.parentId = '0F9M00000008PXSKA2';             

insert e;

 

but during insertion error comes.             

 

Does it mean that salesforce follows feature is not supported in chatter group. Can anyone help on this.

 

Thanks,

Rajiv

  • August 31, 2011
  • Like
  • 0

Hi All,

 

I have included a homepage component with Javascript to have dynamic manipulation of few fields of an object. Below is the script. But after inclusion of this component in the home page layout, related-list hover links are not getting loaded. Also none of the list views displays anything. The list views shows 'loading..' in the left bottom of its frame and its struck there. Does my code have anything that stops sfdc features to work as expected.

 

 

<br> <script>
function callMeNow(){

    var contactNotFound =parent.document.getElementById('00NP0000000XXXX');
    var contactNotFoundDetail =parent.document.getElementById('00NP0000000XXXX_ilecell');
    if(contactNotFound != null){
        contactNotFound.outerHTML="<a href=\"\/003\/e\?nooverride=1\&retURL=\/a0F\/o\" target=\"_blank\"> Click Here To Create New<\/a>";
    }
    if(contactNotFoundDetail != null){
        contactNotFoundDetail.innerHTML="<a href=\"\/003\/e\?nooverride=1\&retURL=\/a0F\/o\" target=\"_blank\"> Click Here To Create New<\/a>";
    }

    return true;
}

window.parent.onload=function(){
    if((window.parent.location.href.indexOf("/a0F")>0 || window.parent.location.href.indexOf("%2Fa0F")>0)){
        callMeNow();
    }
    return true;
}

</script>