• Chuck Tomlinson
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 6
    Replies
Hello,
I am composing an email and I am successfully able to get the recipient's email address (actually I just need the domain) into the email with:
%%=Substring(emailaddr,IndexOf(emailaddr,'@'),100)=%%

So I'm sure that Substring() and IndexOf() DO work in an email [as opposed to microsite and landing pages -- I hear they have different functionality].. but my code that works OUTSIDE of an ampscript block doesn't work INSIDE? as follows:
-------
%%[
/* NOTE: commented out vars?! */
/*var @EMailCount, @lookupDomain*/
set @lookupDomain = "homenwork.com"

/* I want this to work to get the recipient's email address to parse inside my AMPscript block */
/*set @emailaddr = RequestParameter("emailaddr")*/

/* these don't work in here?! do I need some 'functions' feature enabled or something?! weird
set @nPos = IndexOf(@emailaddr,"@")
set @nPos = Add(@nPos,1)
set @lookupDomain = Substring(@emailaddr,@nPos,100)
*/

set @EMailCount = Lookup("CRTdebug", "CounterField", "EMailDomain", @lookupDomain)
]%% 

EmailCount is %%=v(@EMailCount)=%%
-------

Please note that the vars are commented out because something is preventing that syntax because it gave me some error about not having the required comma, but as you can see, there are commas.. I commented them out and the code seems to run fine with me setting values to non-declared variables, which is weird, but whatev.
 
I am using dataloader to export Attachment content associated to a particular object.  Is there any way to pull in custom fields from the the polymorphic relationship when filtering on a specific parent type?

I would like to do something like this:
SELECT
	Id, 
	Name, 
	ParentId, 
	Parent.MyCustomField__c,
	Body 
FROM Attachment 
WHERE Parent.Type = 'MyCustomObject__c'

But this returns the error:
No such column 'MyCustomField__c' on entity 'Name'.

I have tried experimenting with TypeOf with no luck:
SELECT 
	Id, 
	ParentId, 
	TYPEOF Parent 
		WHEN MyCustomObject__c 
		THEN MyCustomField__c 
	END, 
	Name,
	Body
FROM Attachment 
WHERE ParentID IN (SELECT id FROM MyCustomObject__c)

This seems to skip the MyCustomField__c column but returns the other columns.

Is there anyway to do this with one SOQL statement?

Thanks,
​​​​​​​
  • October 07, 2019
  • Like
  • 0
I am attempting to programmatically archive Attachments in Salesforce over to Google Drive. Google Drive API requires OAuth and I am having a little bit of trouble setting it up.

I was trying to avoid building and parsing HTTP Requests/Responses in order to get through the Authorization Flow but my attempts have failed.

First, I configured an API Project via the Google API ConsoleUser-added image

Second, I created an AuthProvider in Salesforce.
User-added image

At this point, I would expect the following code sample to grab an Access Token for me:
system.debug(Auth.AuthToken.getAccessToken('0SO4B000000CacK', 'Open ID Connect'));
However, I receive a null value.

For good measure, duplicated everything for a Google Auth Provider, instead of  Open Id Connect with the same result. I also set up an external data source (which does authenticate and sync) to make sure I had a token.

Has anyone been able to successfully use AuthToken methods when connecting to Google APIs?
Is there anything that I missed along the way?
 
I cannot see the work order object via the Microsoft power query Salesforce object connector. I can succesfully view and query many other objects but the work object does not appear in the power query navigator view (see screenshot). This article states that the work order object is supported by API version 36.0 and later so perhaps power query uses an earlier version?
.User-added image
Hello,
I am composing an email and I am successfully able to get the recipient's email address (actually I just need the domain) into the email with:
%%=Substring(emailaddr,IndexOf(emailaddr,'@'),100)=%%

So I'm sure that Substring() and IndexOf() DO work in an email [as opposed to microsite and landing pages -- I hear they have different functionality].. but my code that works OUTSIDE of an ampscript block doesn't work INSIDE? as follows:
-------
%%[
/* NOTE: commented out vars?! */
/*var @EMailCount, @lookupDomain*/
set @lookupDomain = "homenwork.com"

/* I want this to work to get the recipient's email address to parse inside my AMPscript block */
/*set @emailaddr = RequestParameter("emailaddr")*/

/* these don't work in here?! do I need some 'functions' feature enabled or something?! weird
set @nPos = IndexOf(@emailaddr,"@")
set @nPos = Add(@nPos,1)
set @lookupDomain = Substring(@emailaddr,@nPos,100)
*/

set @EMailCount = Lookup("CRTdebug", "CounterField", "EMailDomain", @lookupDomain)
]%% 

EmailCount is %%=v(@EMailCount)=%%
-------

Please note that the vars are commented out because something is preventing that syntax because it gave me some error about not having the required comma, but as you can see, there are commas.. I commented them out and the code seems to run fine with me setting values to non-declared variables, which is weird, but whatev.
 

I'm quite new to SalesForce and need to start learning APEX. I have just downloaded and installed the following version of Eclipse:

 

http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/europa/winter/eclipse-java-europa-winter-win32.zip

 

and then installed the Force.com IDE using the instructions on this page:

 

http://wiki.apexdevnet.com/index.php/Force.com_IDE_Installation_for_Eclipse_3.3.x

 

I'm now trying to complete some of the Force.com platform tutorials but I can't seem to create a new Force.com project as it crashes every time I try. I perform the following steps to replicate this:

 

- Open Force.com perspective

- File > New > Force.com project

- Enter all the relevant login and security token information to connect to our sandbox

- Verify that the proxy information is all correct

- Click Next

 

At this point the Progress Information popup appears and says "Fetching Organisation Details", which seems to work fine. It then changes to say "Fetching component metadata..." and below the progress bar it says "ApexTrigger, ApexClass, ApexComponent...". At this point Eclipse freezes and I have to kill the process, even after leaving it for half an hour. Nothing shows in the Log in Eclipse.

 

Has anyone experienced this problem? Any help greatly appreciated.

 

FYI... I have tried to following to no success:

 

- Removed Eclipse and reinstalled everything

- Tried using older version of Eclipse

- Tried using older version of Force.com IDE plugin

- Verified my sandbox connection details by logging into the sandbox frontend

- Verified my proxy details in IE

- Re-generated my Salesforce security token

- Entered my login info password in new project window as <password><securitytoken>

- Verified my Java Runtime Environment is > v1.5

- Managed to create new project in Eclipse with my details on a colleague's computer

  • January 29, 2009
  • Like
  • 0