• Scott_VS
  • NEWBIE
  • 430 Points
  • Member since 2011
  • Lead Developer
  • CRM Science


  • Chatter
    Feed
  • 15
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 91
    Replies

I know that objects in salesforce have a 3 digit id, for instance accounts id is 001 so if you type /001 after salesforce.com/ in the url it will pull up a list of the accounts.  I can think of a number of times where having this id could be handy.  Is there a list someone of the default id's?  Also I know that custom objects have an id like this, but the only way I have found to get that ID is to create a tab for the object, open the tab and get the id from the URL.  I was hoping there is a better way to get those ID's.  Thanks.

I am trying to integrate some dashboards from an existing C# ASP.net application into the contacts dashboard as a new section.

 

In a non-Salesforce world I would accomplish this using  a standard HTTP request passing the current Contact ID to my application with the resulting HTTP page being displayed in an iFrame. 

 

How do I accomplish this in Salesforce?

 

I am very new to Salesforce so if I am using the wrong or misleading terminology please excuse me.

 

If the answer is RTFM - please direct me to exactly which documentation I should start with.

 

Thanks in advance.

 

Whatty

  • November 14, 2012
  • Like
  • 0

How can we get Approval Process getWorkitemId if we have the record Id ?

I developed an page with visualforce and saw that i have an page with url ....core.apexpages.devmode.url=1 and an normal url for my page. So every time i changed the code on the visualforce side, it opens the core.apexpages.devmode.url=1 url..Why? What does it mean?

 

regards

 

 

We have created a visualforce page that renders as a PDF.

 

Can anyone give me any recommendations (and even better sample code) on what we could do to have the rendered PDF auto attach to the Feed in Chatter of the same object it is generated from.

 

Any help would be awesome!  Thank you!

I have a wrapper class that creates a line item record on a parent record. The VF page lists the available items to add with an input text field that sets a integer with the quantity ordered.  The method is creating the record as expected, but the quantity is not being set properly. I'm not seeing what I'm missing in the process to properly set the quantity in the child record. Any suggestions? 

 

public class materialOrderWrapperClassController{

    public List<cProducvod> productList {get; set;}
    public Material_Order__c record;
    public List<Product_vod__c> availableProducts= new List<Product_vod__c>();
    public List<Material_Order_line_Item__c> linesToAdd {get;set;}
    public List<Material_Order_line_Item__c> qtysToUpdate {get;set;}
    public List<cProducvod> selectedProducts{get;set;}
    public Boolean hasProdSelect{get;set;}
    public Integer qty {get;set;}   
    
    public materialOrderWrapperClassController(ApexPages.StandardController stdController){
        record = [SELECT id, Name, Date__c, Status__c, Notes__c
                    FROM Material_Order__c 
                    WHERE id =:ApexPages.currentPage().getParameters().get('id')];
        
        selectedProducts = new List<cProducvod>();
        
       
        availableProducts = [SELECT id, Name, Image__c, Product_Type_vod__c 
                                FROM Product_vod__c 
                                WHERE Product_type_vod__c = 'Order'
                                ORDER BY Name ASC];
            //productList = new List<cProducvod>();
            if(productList == null){
              productList = new List<cProducvod>();                                        
              for(Product_vod__c p : availableProducts) {
                productList.add(new cProducvod(p));
            }
        }                                
    }
    

    public List<cProducvod> getProductList() {
         return productList;
    }
        
     public void setQty(Integer q){
         qty=q;
         }
         
     public Integer getQty(){
         return qty;
         }
         
     public pageReference processSelected(){
         selectedProducts.clear();
          hasProdSelect = false;
            for(cProducvod cProd: getProductList()) {
                if(cProd.qty > 0) {
                    selectedProducts.add(cProd);
                    system.debug('cProd qty is >>>>'+cProd.qty);
                    }
              }
        
        linesToAdd = new List<Material_Order_Line_Item__c>();
         for(cProducvod prdct : selectedProducts){
            Material_Order_line_Item__c newLine = new Material_Order_line_Item__c();
            newLine.Products__c = prdct.cProductvod.id;
            system.debug('newLine product name is>>>'+newLine.Products__c);
            newLine.Quantity__c = qty;
            system.debug('newLine qty is >>>'+newLine.Quantity__c);
            newLine.Material_Order__c = record.id;
            linesToAdd.add(newLine);
         }
         insert linesToAdd;
         
         pageReference enterAmount = new pageReference('/'+record.id);
          //pageReference enterAmount = new pageReference('/apex/enterAmt?id='+record.id);
          return enterAmount; 
         }
}

 VF Code: 

<apex:page standardController="Material_Order__c" extensions="materialOrderWrapperClassController">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Process Selected" action="{!processSelected}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!productList}" var="c" id="table">
                <apex:column >
                    <apex:inputText value="{!c.qty}"/>
                </apex:column>
            <apex:column value="{!c.cProductvod.Name}" headerValue="Product"/>
            <apex:column value="{!c.cProductvod.Image__c}" headerValue="Image"/>   
            <apex:column value="{!c.cProductvod.id}"/> 
        </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

I have a trigger that is doing a query and building a rather large found set.  It's one trigger that is firing as part of a larger execution, and it just so happens that the full execution is failing because I'm hitting a governor limit on the number of SOQL rows in the found sets.  Since the data isn't necessary to have immediately, I'm trying to get the queries in this trigger into a class with an @future notation.

 

The problem is that I'm not sure how to convert this trigger below into a trigger that references an Apex, so I can put the query into the @future notation.  Here's the trigger code I have now...

 

trigger MyRollup on CampaignMember (after delete, after insert, after undelete, after update) {

	Map<Id,Campaign> updateCampaigns = new Map<Id,Campaign>();
	Set<Id> updateCampaignIds = new Set<Id>();

	// If we are inserting, updating, or undeleting, use the new ID values
	if(Trigger.isInsert || Trigger.isUpdate || Trigger.isUndelete)
		for(CampaignMember testing:Trigger.new)
			updateCampaignIds.add(testing.CampaignId);

	// If we are updating, some campaigns might change, so include that as well as deletes
	if(Trigger.isUpdate || Trigger.isDelete)
		for(CampaignMember testing:Trigger.old)
			updateCampaignIds.add(testing.CampaignId);

	// Do not create a record for null field
	updateCampaignIds.remove(null);

	// Create in-memory copies for all campaigns that will be affected
	for(Id campaignId:updateCampaignIds)
		updateCampaigns.put(campaignId,new Campaign(id=campaignId,MyRollup__c=0));

	// Run an optimized query that looks for all campaigns that meet the if/then criteria
	for(CampaignMember testing:[select id,campaignid from CampaignMember where CampaignId in :updateCampaignIds and Ready__c=true])
		updateCampaigns.get(testing.CampaignId).MyRollup__c++;

	// Update all the campaigns with new values.
	Database.update(updateCampaigns.values());
		    
}

Any recommendations as to how I can modify this trigger so that it's paired with a new Apex class?

Cheers!

Hi,

 

 

 

 

I need to get all those records which were created in 'This month of Last Year'.  Since this is November 2012, I need to get all the records created in November last year in SOQL query.  I run this query on the 1st of every month.   Is there any exact date literal ?  Can I compare the months or something like that ?

 

I have checked Data Literals, I found LAST_N_DAYS:n .  I used it to build the following query ( which I do not like it)

 

SELECT Id FROM Account WHERE CreatedDate <= LAST_N_DAYS:365  && CreatedDate >= LAST_N_DAYS:335 

(365-335 =30 days difference, 1 month difference)

 

The query gives incorrect results and is not perfect as the query picks 30 days difference every month which is wrong. If I go with this, I need to calculate for 31 days as well and have to consider leap years and all which is hectic.

 

Any simple Ideas please?

 

Hi,

 

I need to create a field Timeslot and it should have dropdown of hour(0-24), minute and am/pm.

Can anyone please tell me how to do this.

 

Thanks

I didn't understand the option of Enable Separate Loading of Related Lists in user interface.. Please expalin the same...

 

 

And What is the difference between Enable Separate Loading of Related Lists & Enable Related List Hover Links

Is oAuth the only means of authenticating to access Apex REST API methods? Is there a way, as in the SOAP API, to provide a user name and password, receive a session ID back and then use that to make susequent calls?

 

It looks to me from the docs and presentations I've read and seen that oAuth is the only official mechanism, but I hope it's not...

 

Thanks!

 

So I figured out how to tell Live Agent to use a custom page... (I think)

 

But when I switch to using a custom page, and the user initiates a chat from a Chat Button, the user is blocked by an "Authorization Required - You must first log in or register before accessing this page." message. I attempted to adjust the "Security" setting of the page, just adding all the roles to the page, and that didn't work.

 

So... how exactly do I expose that custom page so that any of our customers/users (i.e. The Public) can communicate via the custom chat page without requiring a login?

 

Thanks!

 

I need a trigger that will update the contact owner to match the account owner when a contact is created. Can anyone help with some code?

  • June 26, 2012
  • Like
  • 0

When booking an event in Apex I want to be able to check a user's availability. Currently we make users schedule non-working time as recurring events, but this is very clunky and they can only schedule x events in the future.

 

What I'd like to do is access the same Start of Day/End of Day values from the User's Personal Information that controls the display of the calendar, but these fields are not jumping out from the User object. Anyone have a clue where to find them ?

 

 

  • June 14, 2012
  • Like
  • 0

We decided to go with a Force.com Site for our customer portal instead of the standard customer portal. We also want to use the new Social Sign On feature to authenticate our users using their Facebook or SFDC account.

 

Here's our problem: When the user authenticates using Social Sign On, they are automatically redirected to the default customer portal and the session id is stored on that domain. When we try to redirect them to the Force.com Site, the session id cookie doesn't transfer because it is on a different domain.

 

Has anyone else attempted to use Social Sign On authentication for a Force.com Site? Any suggetions on retaining the session id between the portal and the Site?

I am working on an app that will automatically post messages and reminders to a chatter group. I have found that if I post these automated messages under my username, my users assume that I am the one manually writing out the messages. I want to avoid this confusion.

 

I want to create a chatter free user to serve as the face of my automated message, much like how Salesforce creates the "Chatter Expert" user on a new org and sends out a private message to each user. I can't run System.runAs() on a non test method, but I have found this in the Feed Item documentation:

 

If the logged-in user has the Insert System Field Values for Chatter Feeds user permission, the create field property is available on CreatedById and CreatedDate system fields for this object. This allows the logged-in user to set these fields to the original post author and creation date upon migration instead of accepting the system field value when migrated, which would be the logged-in user and the date the migration was performed, respectively. The fields can't be updated after migration.

 

And this also seems to be demoed in the 13th recipe in the Chatter Code Recipe page.

 

So then why is this not working when I try it myself? I am logged in as a System Admin, and the "Insert System Field Values for Chatter Feeds" is checked on by default. However, I keep on getting a INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: [] error when I try it.

 

// Create Chatter Free User
Profile p = [SELECT id From profile WHERE name='Chatter Free User'];
        
User u = new User(alias = 'test1', email='testuser@testorg.com',
            emailencodingkey='UTF-8', lastname='testtest', languagelocalekey='en_US',
            localesidkey='en_US', profileid = p.Id,
            timezonesidkey='America/Los_Angeles', username='testingauser@foobar.com');
insert u;

// Create Post as user
FeedItem post = new FeedItem();
post.parentId = [CHATTER GROUP ID];
post.body = 'This is my test post.';
post.CreatedById = u.id;
post.CreatedDate = System.now();
        
insert post;

 

I am trying to post to the Chatter Rest API using the request body instead of a request parameter. This is what my code looks like:

 

HttpRequest req = new HttpRequest();
  
req.setEndpoint('https://na12.salesforce.com/services/data/v23.0/chatter/feeds/news/me/feed-items');
req.setMethod('POST');
req.setHeader('Authorization', 'OAuth ' + userInfo.getSessionId());
req.setHeader('Content-Type:', 'application/json');
req.setBody('{ "body" : { "messageSegments" : [{ "type": "Text","text" : "foo bar"}]}}');

Now according to this documentation, if I define the content type as application/x-www-form-urlencoded, it will be looking at the request parameters for the "text" field. However, since I'm defining the content type as application/json, it will be looking at the request body for all the info.

 

So why is it ignoring the body and telling me that I need to use the "text" field in the request parameters?

I am using the SFDC app for iPhone and a created a link to a mobile visualforce page using the method described in this page. Clicking the link brings up the page in an in-app web browser.

 

Is there a way to close this in-app browser from the visualforce page and return the user back to the app screen? It seems like the JavaScript line window.self.close() will not work in this browser. 

Hi All,

I have 3 objects called A,B,C and I have to write trigger on C and i want to update object A field i.e.,Balance__C fileld with Object B filed of TotalAmount__c (B is child of A and C id Child of B). How can i achieve this please give a code for this Thanks in Advance..

Regards
A.Jagadeesh
Hi,

We are trying to post chatter files (up to 10mb) using an ETL tool, currently Informatica, but keep running into what I think is a file size limitation of the SOAP API, for the files keep getting cut off around 5mb. Any tips on how to post files above 5mb to salesforce chatter feeds? Can this be done through the API or any ETL tool?

Thanks.
  • November 18, 2014
  • Like
  • 0
I have 2 custom objects

Timecard (pse__Timecard_Header__c)
Period (c2g__codaPeriod__c).

They don't have relationship.

Timecard fields:- Start date (pse__Start_Date__c), Close date (pse__CloseDate__c), Project (pse__Proj__c). Now here, inside project is one field Region (pse__Region__c).

Period fields:- Start date (c2g__StartDate__c), Close date (c2g__Closed__c), Region (c2g__Region__c ), status (checkbox).

If the status is checked and start date, close date and region are matching with the start date, close date and region of Timecard object then I want Timecard to be rejected.

I started with the following code but then get lost realising I don't have direct access to region inside project.
trigger TimecardRejection on pse__Timecard_Header__c (before update)
 { 
      List tcdata = new List ();

     for(pse__Timecard_Header__c tc: Trigger.new)
     { 
         tc.pse__Start_Date__c tc.pse__End_Date__c tcdata.add(tc); 
      }
}
Any help would be appreciated. Thanks in advance.
 

Hi all, 

 

How can I view my profile image (and any other UI resources) with my access_token ?

 

I only managed to view the image with a sid like:

https://c.na9.content.force.com/profilephoto/729E0000000D1Kg/T?sid=blabla

 

10'x.

  • November 25, 2012
  • Like
  • 0

Hi,

 

We are getting the error below in a visualforce page because we have exceeded the API limit.

How can we use/visualize the page again? Should we contact salesforce support?

 

 

Uncaught {faultcode:’sf:REQUEST_LIMIT_EXCEEDED’, faultstring:’REQUEST_LIMIT_EXCEEDED: TotalRequests Limit exceeded.’, detail:{UnexpectedErrorFault:{exceptionCode:’REQUEST_LIMIT_EXCEEDED’, exceptionMessage:’TotalRequests Limit exceeded.’, }, }, }

 

 

Many Thanks,

Altran

 

 

 

  • November 20, 2012
  • Like
  • 0

How to achieve primarkey/foreign key in salesforce?

Hi All

 

 How can i integrage salesforce with social networking sites like facebook, etc.plz help

How do we update the values selected from a checkbox in a visualforce page onto a standard object?

I want to display a list of active users in salesforce and on checkbox click deactivate the corresponding user accounts.

Hi,

I have modified some out of the box Cases view list and layouts, I have also added some values to a custom picklist.

Then I create a new package and install it into another org (an update of the same package). The thing is that those modifications didn't take effect in the org where I had installed the package.

 

2 questions:

Is this right ?

Is it possible to include these modifications in a package and so update the cases components of the other org ?

 

Thanks in advance.

I know that objects in salesforce have a 3 digit id, for instance accounts id is 001 so if you type /001 after salesforce.com/ in the url it will pull up a list of the accounts.  I can think of a number of times where having this id could be handy.  Is there a list someone of the default id's?  Also I know that custom objects have an id like this, but the only way I have found to get that ID is to create a tab for the object, open the tab and get the id from the URL.  I was hoping there is a better way to get those ID's.  Thanks.

Error:unable to fetch and save Force.com components to project

Hi Friends, From the salesforce customer portal which is accessible to outside public, when somebody request something such as web service then which IP address is used .Is that customers IP address or salesforce IP address will be used to access web services from salesforce portal? Any reply will be highly appreciated? Thanks, Trick
  • November 15, 2012
  • Like
  • 0

I am trying to integrate some dashboards from an existing C# ASP.net application into the contacts dashboard as a new section.

 

In a non-Salesforce world I would accomplish this using  a standard HTTP request passing the current Contact ID to my application with the resulting HTTP page being displayed in an iFrame. 

 

How do I accomplish this in Salesforce?

 

I am very new to Salesforce so if I am using the wrong or misleading terminology please excuse me.

 

If the answer is RTFM - please direct me to exactly which documentation I should start with.

 

Thanks in advance.

 

Whatty

  • November 14, 2012
  • Like
  • 0

How can we get Approval Process getWorkitemId if we have the record Id ?

I need to create approval steps in apex programmetcally.Does anyone knows about it.

I am getting this error when i am trying to update.

 

list

<Account> accList;

 

list<Account> accountUpdate=newlist<Account>();

 

if(recordOwnerString()=='Owner'){

accList=[

select id,Name,OwnerId fromAccountwhereOwnerId=:selectedOwnerId];

 

// if(accList.size()>0){for(AccountaccRec : accList){

 

Account acc=newAccount(id=accRec.id,OwnerId=secondUserId());

accountUpdate.add(acc);

}

if(accountUpdate.size()>0){

 

updateaccountUpdate; ---> getting error on this line

}

//}

 

 

  • November 13, 2012
  • Like
  • 0

We have created a visualforce page that renders as a PDF.

 

Can anyone give me any recommendations (and even better sample code) on what we could do to have the rendered PDF auto attach to the Feed in Chatter of the same object it is generated from.

 

Any help would be awesome!  Thank you!