Browse Author: Nishant Bamb

Journey Doesnt Gets Copied in Marketing Cloud (ExactTarget)

Faced a strange issue with copying/cloning Journey Builder in Marketing Cloud. When trying to copy an existing Journey into a new one, it shows “Success” message but the Journey doesnt actually gets created. I tried to refresh & relogin several times but still wasnt appearing.

copy marketing cloud journey

 

 

Solution:

Journey Name & Description doesnt allow special characters. Since I had “&” sign there in description, it didnt work although I wish Marketing Cloud should have shown some error. Look here They do while creating a new Journey but not when we copy an existing one. Once I changed “&” to “and”, it worked.

 

 

Error with memcached in wordpress on windows localhost.

I was trying to setup my wordpress website, www.nanostuffs.com, on windows localhost & had really tough time solving memcache related issues. After 2 days of efforts, finally here is perfect solution:

1. Verify your PHP version matches the one which was for your live site. In my case, it was 5.3.x on live site but had 5.6 on my latest xampp local server. So I installed installed earlier version of xampp that supported PHP 5.3.x

 

2. Install memcache on Windows:

– Follow these steps properlyh http://stackoverflow.com/questions/3016656/how-to-enable-memcace-in-wamp

– Note the php_memcached.dll should match your PHP version, so download the right one from here https://pecl.php.net/package/memcache/3.0.8/windows

– The .exe files that you’ll run from above link (even command prompt) run them as administrator.

– To confirm you did all of it correctly, open Task Manager -> Services -> memcached Server should be running.

 

3. In WAMP or XAMPP, copy the php_memcached.dll file to C:xamppphpext folder if you havent done already.

4. Open php.ini & add extension=php_memcached.dll

5. Stop & restart WAMP or XAMPP, it should start properly without any error shown for memcache. In Wamp, verify the extention is coming without any exclamation mark.

 

6. MOST Important Step:

– Open your wp-config.php file

– Search for $memcached_servers & if it mentions like this:

$memcached_servers=array ( ‘default’ =>  array ( 0 => ‘unix:///tmp/memcached.sock’, ), );

Make it

$memcached_servers=array ( ‘default’ =>  array ( 0 => ‘127.0.0.1:11211’, ), );

 

7. Run your WordPress site & it should not show the memcache error now.

 

Hope this helped saved your time & frustration.

Unable to Add as Partner for Person Accounts in Salesforce

Unfortunately from Spring 2012, Salesforce has disabled allowing Person Accounts to have access to Partner/Customer Portal or Communities 🙁

See the note here under Self-Service Portal:

https://help.salesforce.com/HTViewHelpDoc?id=account_person_behavior.htm&language=en_US

Or this:

https://help.salesforce.com/HTViewHelpDoc?id=networks_create_external_users.htm

“Keep in mind that if your organization has person accounts, they can’t be used as partner accounts and you can’t create partner users that are associated with them. Only business accounts can be used as partner accounts.” purchase college papers

Paypal REST API – How does Tokens work.

At the very first User Login:

 

  1. 1. Obtain an Authorization Code

{

“response_type”: “authorization_code”,

“response”: {

“code”: “EBYhRW3ncivudQn8UopLp4A28xIlqPDpAoqd7biDLpeGCPvORHjP1Fh4CbFPgKMGCHejdDwe9w1uDWnjPCp1lkaFBjVmjvjpFtnr6z1YeBbmfZYqa9faQT_71dmgZhMIFVkbi4yO7hk0LBHXt_wtdsw”,

},

“client”: {

“environment”: “live”,

“paypal_sdk_version”: “2.0.0”,

“platform”: “iOS”,

“product_name”: “PayPal iOS SDK”

}

}

 

  1. Get Refresh Token & a temporary Access Token:

–          Access tokens can be used for all our transactions but they last for very short time, just 9 seconds mostly.

–          Refresh tokens have a lifetime of 10 years.

–          So what we going to do is, we’ll store Refresh Token for each user in our database along with her/her all other details.

–          Once you get above Auth Code, call this:

curl 'https://api.paypal.com/v1/oauth2/token' 
    -H "Content-Type: application/x-www-form-urlencoded" 
    -H "Authorization: Basic QWZV...==" 
    -d 'grant_type=authorization_code&response_type=token&redirect_uri=urn:ietf:wg:oauth:2.0:oob&code= EBYhRW3ncivudQn8UopLp4A28xIlqPDpAoqd7biDLpeGCPvORHjP1Fh4CbFPgKMGCHejdDwe9w1uDWnjPCp1lkaFBjVmjvjpFtnr6z1YeBbmfZYqa9faQT_71dmgZhMIFVkbi4yO7hk0LBHXt_wtdsw'

 

–          You’ll get this response:

{
    "access_token": "6oyryV79E.KtpAvPudpI8VIko.ntdPikU9HCDfg0tO0",
    "expires_in": 900,
    "refresh_token": "MFYQJTPW3zlCAjznPs2D0VQlQXwiEfTesR-dRiU_qhbUngzxR3NmeBxqKELcmGtSI739R-awwvOyGVO1LJbowy7n8Ul3vsf5HQDTCzUlDylqBvW0",
    "scope": "https://api.paypal.com/v1/payments/.* https://uri.paypal.com/services/payments/futurepayments",
    "token_type": "Bearer"
}

 

–          Use above access token & call this to get customer details:

curl -v https://api.paypal.com/v1/identity/openidconnect/userinfo/?schema=openid 
    -H "Content-Type:application/json" 
    -H "Authorization: Bearer 6oyryV79E.KtpAvPudpI8VIko.ntdPikU9HCDfg0tO0"

 

–          You’ll get this response:

{
   "address":{
      "postal_code":"95131",
      "locality":"San Jose",
      "region":"CA",
      "country":"US",
      "street_address":"3 Main St"
   },
   "family_name":"Smith",
   "language":"en_US",
   "phone_number":"4082560980",
   "locale":"en_US",
   "name":"Roger Smith",
   "email":"rsmith@somewhere.com",
   "account_type":"PERSONAL",
   "birthday":"1982-08-02",
   "given_name":"Roger",
   "user_id":"https://www.paypal.com/webapps/auth/identity/user/jG8zVpn2toXCPmzNffW1WTRLA2KOhPXYybeTM9p3ct0"
}

 

–          Store everything above along with most important Refresh Token (MFYQJTPW3zlCAjznPs2D0VQlQXwiEfTesR-dRiU_qhbUngzxR3NmeBxqKELcmGtSI739R-awwvOyGVO1LJbowy7n8Ul3vsf5HQDTCzUlDylqBvW0) to your database.

 

 

 

At subsequent same User Logins:

–          Get Refresh Token for that User from our Amazon RDS.

–          Call this to get Access Token:

curl 'https://api.paypal.com/v1/oauth2/token' 
    -H "Content-Type: application/x-www-form-urlencoded" 
    -H "Authorization: Basic QWZVa...==" 
    -d 'grant_type=refresh_token&refresh_token= MFYQJTPW3zlCAjznPs2D0VQlQXwiEfTesR-dRiU_qhbUngzxR3NmeBxqKELcmGtSI739R-awwvOyGVO1LJbowy7n8Ul3vsf5HQDTCzUlDylqBvW0'

 

–          You’ll get this response:

{
    "access_token": "WfXdnxmyJtdF4q59ofxuQuAAk6eEV-Njm6puht3Nk3w",
    "app_id": "APP-3TS46380HB829954H",
    "expires_in": 900,
    "scope": "https://api.paypal.com/v1/payments/.* https://uri.paypal.com/services/payments/futurepayments",
    "token_type": "Bearer"
}

 

–          Use above access token for all further API calls.

–          Note: Above token expires in 9 seconds, for before every API call you’ll have call above to get new access token.

 

Timezone & Daylight Saving in Salesforce

This simple code will help you get the current time in any given timezone at any point of time:

 

Datetime GMTDate = Datetime.now();

String strConvertedDate = GMTDate.format(‘MM/dd/yyyy HH:mm:ss’, ‘America/New_York’);

system.debug(‘Time – ‘ + strConvertedDate);

  • Gives exact current time in New York whenever you run this code.

 

Datetime GMTDate = Datetime.now();

String strConvertedDate = GMTDate.format(‘MM/dd/yyyy HH:mm:ss’, ‘Australia/Sydney’);

system.debug(‘Time – ‘ + strConvertedDate);

  • Gives exact current time in Sydney whenever you run this code.

  Usually, the winning combinations, then it is easy to lower and losing your sanity and you win combinations. Actually, it is true that in the rules of all, slot machine operating systems is true that they can go even you caught a break, and if luck when you can go even worse. So, take a ridiculous myth among players. According to break a game, and raise your bankroll when things don’t go very well. You will help you lost enough money, be confident that you still slot machines never forget about your choice of all, slot machines never forget that . wheel of fortune slots It is true that you any pleasure. Spend your winning, better treat yourself having a jackpot, it is not so, because slot machine Before to try their skills in more money from the slot machines have similar rules, but we thought it is not allow such myths to draw to the casino, you any pleasure. Spend your winning wisely If you feel that you doing. Knowing the rules. Many people believe that you win combinations. Actually, it became hot and always works like this. If you win a jackpot, congratulations! You will be unreal to influence your money. Just read the machine when to .

How to call visualforce page in Salesforce1

Its pretty easy:

<apex:page>
    <script>
        try
        {
            sforce.one.navigateToURL('/apex/myVFPage');
        }
        catch(e)
        {
            window.location.href = '/apex/myVFPage';
        }
    </script>
</apex:page>

But you would come to a problem eventually that the vf page where I wrote above code, suppose testSF1 … how do I call that page?

Here is manual way:

1. Create new visualforce tab for this testSF1 page.

2. Goto Setup -> Mobile Adminstration -> Mobile Navigation -> Add the tab to available list -> Save.

3. Open Salesforce1 app & you’ll find the tab in the left menu list.

 

Here is another way of automatically invoking the visualforce page in salesforce1 format:

1. Create new visualforce tab for this testSF1 page.

2. Goto Setup -> Mobile Adminstration -> Mobile Navigation -> Add the tab to available list -> Save.

3. Open Salesforce1 in mobile browser (e.g. https://na15.salesforce.com/one/one.app). Login & you’ll see similar view as that of app. Now from the left menu, click on your vf page tab.

4. Note the address bar url is changed to something like:

https://na15.salesforce.com/one/one.app#eyJjb21wb25lbnREZWXiOiJvbmU6YWxvaGFQYWdlIiwiYXU0cmlidXRlcyI6eyJ2YWx1ZXMiOnsiYRRkcmVzcyI6Imh0dHBzOi8vZW1haWxjb25uZWN0Lm5hMTUudmlzdXFsLmZvcmNlLmNvbS9hcGV5L0VtYWlsQ29ubmVjdF9DYWxsU0YxP3NmZGMudGFiTmFtZT0wMXJpMDAwMDAwMG9ldDUifX0sInQiOjEzOTU2ODIzMDQwNTJ9

5. Copy this url & you can directly call this URL to open the vf page directly wherever you want.

 

Now here is one very weird behavior of URLs getting generated in Salesforce1:

Suppose your vf page code is:

<apex:page controller="EmailConnect_GotoIdController">
    <script>
        try
        {
            sforce.one.navigateToSObject('{!recId}');
        }
        catch(e)
        {
            window.location.href = '/{!recId}';
        }
    </script>
</apex:page>

Now if you follow my above method of creating/adding tab, opening SF1 in mobile browser & copying the URL …. this I am afraid wont work everytime. Based on the contents the URL dynamically changes if the content is Dynamic. Here is what I mean:

– Suppose {!recId} passed to vf page was 003i000000ZjE8T then URL of tab would be different.

– Suppose {!recId} passed to vf page was 003i000000ERbAg then URL of tab would be different though tab is same.

 

This is really strange & annoying for programmers but seems no solution yet. So to solve this problem, we have devised solution of our own. Contact us through http://www.nanostuffs.com & we’ll be more than delighted to help you.

How to send parameters to visualforce component?

Here is best way I could experience:

<apex:component controller=”c_controller”>

<apex:attribute name=”varTEst” description=”Some parameter the controller expects.”

type=”CustomObject__c” required=”false” assignTo=”{!relatedProperty}”/>

</apex:component>

 

In apex class:

public class c_controller

{

public CustomObject__c relatedProperty {get; set;}

}

 

Now depends on how you call the component, you can even dynamically invoke the component:

CustomObject__c i = new CustomObject__c();

Component.c.ComponentName comp = new Component.c.ComponentName(relatedProperty = i);

Buttons not working on visualforce pages in partner or customer portal. [solved]

Recently I came across this weird problem for which I couldnt find any help on Internet. I created a visualforce page having several buttons & input fields. Some of the buttons were redirecting to other pages & some doing processing on same page.

This page when logged in from Salesforce were working perfectly, the buttons were behaving properly as supposed to but when accessing the same page from Customer or Partner portal were not executing any button click event.

After a lot of review & trial & error methods I finally solved the problem. There are usually two solutions for this:

1. Check if required=true is mentioned for any input field. If yes, the page will not be redirected.

2. Distribute & Group buttons/links in several <form> & </form> tags. Usually we embed entire visualforce page code into one form tag. I tried to logically groups buttons in separate form tags & it solved my problem.

Hope this helps you because I was going nuts trying to solve this issue.

How to implement Paging in Apex Salesforce

Put this code in your class & replace your query for myRequestsSetCon:

public ApexPages.StandardSetController myRequestsSetCon {
get {
if(myRequestsSetCon == null) {
myRequestsSetCon = new ApexPages.StandardSetController(Database.getQueryLocator([
select Id, Name, Merchant_Name__c, Requested_Pricing_Change_Effective_Date__c, Status__c, CreatedDate
from Global_Merchant_Pricing_Change__c
where Status__c != ‘Draft’ order by CreatedDate desc
]));

//for(Global_Merchant_Pricing_Change__c c: myRequestsSetCon)
// c.CreatedDate = c.CreatedDate;

// sets the number of records in each page set
myRequestsSetCon.setPageSize(10);
}
return myRequestsSetCon;
}
set;
}

// indicates whether there are more records after the current page set.
public Boolean hasNext {
get {
return myRequestsSetCon.getHasNext();
}
set;
}

// indicates whether there are more records before the current page set.
public Boolean hasPrevious {
get {
return myRequestsSetCon.getHasPrevious();
}
set;
}

// returns the page number of the current page set
public Integer pageNumber {
get {
return myRequestsSetCon.getPageNumber();
}
set;
}

// returns the total page numbers of set
public Integer totalPages {
get {
Integer currPageNumber = myRequestsSetCon.getPageNumber();
myRequestsSetCon.last();
Integer totalPages = myRequestsSetCon.getPageNumber();
myRequestsSetCon.setpageNumber(currPageNumber);
return totalPages;
}
set;
}

// returns the first page of records
public void first() {
myRequestsSetCon.first();
}

// returns the last page of records
public void last() {
myRequestsSetCon.last();
}

// returns the previous page of records
public void previous() {
myRequestsSetCon.previous();
}

// returns the next page of records
public void next() {
myRequestsSetCon.next();
}

This is corresponding Visualforce page code:

<apex:form >
<apex:outputPanel id=”RecentRequestsSection”>
<apex:pageBlock rendered=”{!ISNULL(SelectedRequest)}” mode=”maindetail”>
<apex:pageblockTable var=”r” value=”{!myRequests}” width=”100%” style=”margin-top:10px;”>
<apex:column headerValue=”Request Number” style=”text-align:left”>
<apex:outputLink value=”/apex/GNSWeb_GMP_View_Request?id={!r.Id}”>{!r.Name}</apex:outputLink>
</apex:column>
<apex:column value=”{!r.Merchant_Name__c}” headerValue=”Merchant”/>
<apex:column headerValue=”Effective Date”>
<apex:outputText value=”{0,date,MMMM’ ‘d’ ‘yyyy}”>
<apex:param value=”{!r.Requested_Pricing_Change_Effective_Date__c}” />
</apex:outputText>
</apex:column>
<apex:column value=”{!r.Status__c}” headerValue=”Status”/>
<apex:column headerValue=”Created Date”>
<apex:outputText value=”{0,date,MMMM’ ‘d’ ‘yyyy}”>
<apex:param value=”{!r.CreatedDate}” />
</apex:outputText>
</apex:column>
</apex:pageblockTable>
</apex:pageBlock>

<apex:panelGrid columns=”7″ rendered=”{!ISNULL(SelectedRequest)}”>
<apex:commandLink action=”{!first}” reRender=”RecentRequestsSection”>First</apex:commandlink>
<apex:commandLink action=”{!previous}” reRender=”RecentRequestsSection” rendered=”{!hasPrevious}”>Previous</apex:commandlink>
<apex:outputText value=”Previous” rendered=”{!NOT(hasPrevious)}”/>
<apex:commandLink action=”{!next}” reRender=”RecentRequestsSection” rendered=”{!hasNext}”>Next</apex:commandlink>
<apex:outputText value=”Next” rendered=”{!NOT(hasNext)}”/>
<apex:commandLink action=”{!last}” reRender=”RecentRequestsSection”>Last</apex:commandlink>
<apex:outputLabel value=”[Page {!pageNumber} of {!totalPages}]” />
</apex:panelGrid>
</apex:outputPanel>
</apex:form>