+ Start a Discussion
Assaf MilmanAssaf Milman 
Hi everyone,
My company needs to sync between our AWS MySQL db and the SalesForce db.
The sync will be bidirectional, and updates on both ends should have a latency of less than 1 min.
I've seen https://developer.salesforce.com/forums/ForumsMain?id=906F00000008sHdIAI, which asked the same thing 6 years ago. One of the solutions over there were to use a framewrok called CloudConnect (http://www.cloudconnect.com/). Is looks promising, but evidently SalesForce acquired them 2 years ago.
  1. Anybody knows if CloudConnect still exists for mySQL?
  2. Are there other framewroks for this purpose that you know of?
Thanks a lot,
Assaf
Best Answer chosen by Assaf Milman
Vivek_PatelVivek_Patel
Hi Assaf,

You can also use informatica cloud for your requirement and if you want to go for open source free alternative then Talend would be the best choice.

Regards,
Vivek Patel.

Please like or mark this as best answer if this solves you problem
Pratik Raut 14Pratik Raut 14 
Hi All,
In the code scanning, I am facing the Client Use Of Iframe Without Sandbox issue.
Scan Result:
User-added image
Can anyone please provide me any solution on this?

Thanks,
Pratik
Best Answer chosen by Pratik Raut 14
@Amit Kumar Giri@Amit Kumar Giri
@Pratik- As i suggested earlier, can u chrk whether u have below attributes in ur iframe ?

sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
JeriMorrisJeriMorris 
My VF page has an inputField component for a date field that represents someone's birthdate. The HTML that gets generated from this includes a link that allows the user to select the current date. For birth dates, it's pretty rare that this link is useful. Is there any way to remove the link, but still keep the rest of the date picker functionality?

For what it's worth, I tried defining this style sheet rule:

   .hideDateFormat a {display:none;visibility:hidden;}

and adding this to the inputField tag:

    styleClass="hideDateFormat"

This successfully hides the date link, but not the square brackets that surround the link, so what I'm left with is a text entry field (which the user an click to invoke the date picker), followed by empty square brackets. I can't figure out how to remove the brackets.

Thanks,

Jeri
Best Answer chosen by Admin (Salesforce Developers) 
TehNrdTehNrd
So I was able to figure it out. I just added this to the bottom of my page.

Code:
<style type="text/css">
.dateFormat{
   visibility:hidden;
}
</style>

The problem I see with this is that if you have any other output/input fields that use this styling they won't show up. For me this isn't a issue as the only type of field my page has is a date input field.

Juliver AnoosJuliver Anoos 
Hi , i need help. i need a test class for this method from the class name, ASPP_PaymentSource_Controller.cls
@AuraEnabled
    public static Map<String, String> savePS(ASPayment_Source__c ps, String gatewayId){
        System.debug('PS Handed: ' + ps);
        if(ps != null){
            Map<String, String> info = new Map<String, String>();

            Id cardRT = RecordTypeHelper.getRecordTypeIDByName('ASPayment_Source__c', 'Credit_Card');
            Id bankRT = RecordTypeHelper.getRecordTypeIDByName('ASPayment_Source__c', 'Bank');

            if(ps.RecordTypeId == cardRT || ps.RecordTypeId == bankRT){
                try{
                    upsert ps;
                    
                    info.put('message', 'Payment Source successfully created/udpdated.');
                    info.put('id', ps.Id);
                    info.put('isSucess', 'true');

                    return info;
                }catch(Exception e){
                    info.put('message', e.getMessage());
                    info.put('isSucess', 'false');

                    return info;
                }
            }// end if
            
            // Validate if Payment Source have contact or account
            if(ps.PPContact__c == null && ps.Account__c == null){
                info.put('message', 'Payment Source requires either Account or Contact.');
                info.put('isSucess', 'false');

                return info;
            }

            Map<String, String> result = new Map<String, String>();
            
            if(ps.Id != null){
                ASPayment_Source__c oldPS = [Select Id, Name, RecordTypeId, Account__c, 
                                                 PPContact__c, Active__c, Gateway_Payment_Type__c, 
                                                 Card_Name__c, Card_Expiry_Month__c, 
                                                 Card_Expiry_Year__c, token_Card_CCV__c, 
                                                 token_Card_Number__c, Credit_Card_Type__c, 
                                                 Account_BSB__c, Account_Name__c, 
                                                 token_Account_Number__c 
                                             FROM ASPayment_Source__c 
                                             WHERE Id =: ps.Id];
                
                if(oldPS != null){
                    if((ps.Gateway_Payment_Type__c == 'Bank' && (ps.Account_Name__c == oldPS.Account_Name__c && ps.Account_BSB__c == oldPS.Account_BSB__c && ps.token_Account_Number__c == oldPS.token_Account_Number__c)) || 
                        (ps.Gateway_Payment_Type__c == 'Credit Card' && (ps.Card_Name__c == oldPS.Card_Name__c && ps.token_Card_Number__c == oldPS.token_Card_Number__c && ps.Credit_Card_Type__c == oldPS.Credit_Card_Type__c && ps.Card_Expiry_Month__c == oldPS.Card_Expiry_Month__c && ps.Card_Expiry_Year__c == oldPS.Card_Expiry_Year__c && PS.token_Card_CCV__c == oldPS.token_Card_CCV__c))) 
                    {
                        try{
                            update ps;
                            result.put('PaymentSourceID',String.valueOf(ps.Id));
                            result.put('status','200');
                            result.put('message','Payment Source Updated');
                        }catch(Exception e){
                            result.put('status','500');
                            result.put('message',e.getMessage());
                        }
                    } else result = ProcessPayment.setPS(ps, gatewayId);
                } //end of if(oldPS != null)
            }else{
                if(ps.Gateway_Payment_Type__c == 'Credit Card'){
                    ps.Account_Name__c = null;
                    ps.token_Account_Number__c = null;
                    ps.Account_BSB__c = null;
                }else {
                    ps.Card_Name__c = null;
                    ps.token_Card_Number__c  = null;
                    ps.Credit_Card_Type__c = null;
                    ps.Card_Expiry_Month__c = null;
                    ps.Card_Expiry_Year__c = null;
                    ps.Card_CCV__c = null;
                }
                
                result = ProcessPayment.setPS(ps, gatewayId); 
            } 
            
            info.put('message', result.get('message'));
            if(result.get('status') !=  '500'){
                info.put('id', result.get('PaymentSourceID'));
                info.put('isSucess', 'true');
            }else info.put('isSucess', 'false');
            
            return info;    
        }else return null;
    }
thanks in advance..
 
Best Answer chosen by Juliver Anoos
edanna kedanna k
Dear Juliver Anoos,

1. Create 2 methods in your test class.
2. first method  - insert a ASPayment_Source__c record with either Credit_Card or Bank record types and make sure PPContact__c and Account__c are null.
3. second method - update a ASPayment_Source__c record with 'Bank' Account_Name__c and 'Credit Card' Card_Name__c(different values as compared in first method values).
    
Suggest you to post your test class code and which lines of code are not covering!
Robert Davis 1Robert Davis 1 
I have a trigger on the Account that looks into a Custom Metadata Type and if the User Id is there they are allowed to delete the record otherwise they receive an error message.

The trigger acts as expected in testing my problem is I do not understand how to write the test code.

Account Trigger:
trigger AccountTrigger2 on Account ( before delete) 
{
    Account_Trigger_Handler handler = new Account_Trigger_Handler();    
    if(Trigger.IsDelete)
    {
        handler.OnDelete_Account(Trigger.old);
        
    }//End if
}//End class
Trigger Handler:
public with sharing class Account_Trigger_Handler {

    public void OnDelete_Account(List<Account> acct)
    {
        //get user id for current user
        Id uid = UserInfo.getUserId();
        system.debug('User id : '+uid);
        //create a map to put in all the users who are authorized to delete
        Map<Id,Account_Delete_User__mdt> mapAcctDeleteUser = new Map<Id, Account_Delete_User__mdt>(); 
        //loop through the users who are authorized to delete and put them in the map we created just before this
        for(Account_Delete_User__mdt AcctDeleteUser : [SELECT id, UserId__c FROM Account_Delete_User__mdt])
        {
            mapAcctDeleteUser.put(AcctDeleteUser.Userid__c, AcctDeleteUser);
        }//end for
        
        //loop through the records in the trigger and see if the current user is authorized to delete.
        for(Account a: acct)
        {
            if(mapAcctDeleteUser.keyset().contains(uid)== false)
            {
            a.addError('You are not authorized to remove Accounts from Salesforce. Please email Salesforce.admin@XXXXX.net to have record removed.');
            }//end if
        }//end for           
     }//end method
  }
The following is the test class I have so far, but it gets the error: System.AsyncException: Metadata cannot be deployed from within a test

But I do not know how to fix:
@isTest
public class Account_Trigger_HandlerTest {
  
    public static testMethod void OnDelete_AccountTest()
    {
        Profile p2 = [SELECT id FROM Profile WHERE Name ='Standard User'];
        
        User usr2 = new User (LastName ='Boris',
                              FirstName ='Badenov',
                              Email = 'boris.badenov@bullwinkleshow.com',
                              Username = 'boris.badenov@bullwinkleshow.com',
                              Alias = 'boris',
                              Profileid = p2.Id,
                              TimeZoneSidKey ='GMT' ,
                              LanguageLocaleKey = 'en_US',
                              EmailEncodingKey = 'UTF-8',
                              LocaleSidKey = 'en_US');
        insert usr2;
    //---------------------------------------------------------------------
    //https://ashwanisoni.wordpress.com/2017/05/02/create-or-update-custom-metadata-type-via-apex-code-salesforce-summer-17/
        // Set up custom metadata to be created in the subscriber org.
    Metadata.CustomMetadata customMetadata =  new Metadata.CustomMetadata();
    customMetadata.fullName = 'Account_Delete_User';
    customMetadata.label = 'User';

    Metadata.CustomMetadataValue customField = new Metadata.CustomMetadataValue();
    customField.field = 'UserId__c';
    customField.value = usr2.id;

    customMetadata.values.add(customField);

    Metadata.DeployContainer mdContainer = new Metadata.DeployContainer();
    mdContainer.addMetadata(customMetadata);

    // Setup deploy callback, MyDeployCallback implements
    // the Metadata.DeployCallback interface (code for
    // this class not shown in this example)
    CustomMetadataCallback callback = new CustomMetadataCallback();

    // Enqueue custom metadata deployment
    // jobId is the deployment ID
    Id jobId = Metadata.Operations.enqueueDeployment(mdContainer, callback);
    //----------------------------------------------------------------------
        Profile p = [SELECT id FROM Profile WHERE Name ='Standard User'];
        
        User usr1 = new User (LastName ='Fatale',
                              FirstName ='Natasha',
                              Email = 'natasha.fatele@bullwinkleshow.com',
                              Username = 'natasha.fatele@bullwinkleshow.com',
                              Alias = 'natas',
                              Profileid = p.Id,
                              TimeZoneSidKey ='GMT' ,
                              LanguageLocaleKey = 'en_US',
                              EmailEncodingKey = 'UTF-8',
                              LocaleSidKey = 'en_US');
        insert usr1;
        Account acct2 = New Account(Name='Snagglepuss', Type='Prospect', SSN__c = '12385678', CreatedById = usr1.id);
        insert acct2;
        Test.startTest();
            Database.DeleteResult result = Database.delete(acct2,false);
            System.assert(!result.isSuccess());
        Test.stopTest();
        
        
    }
}
The following is the callback function that the test code references:
public class CustomMetadataCallback implements Metadata.DeployCallback {
    public void handleResult(Metadata.DeployResult result,
                             Metadata.DeployCallbackContext context) {
        if (result.status == Metadata.DeployStatus.Succeeded) {
            System.debug('success: '+ result);
        } else {
            // Deployment was not successful
            System.debug('fail: '+ result);
        }                       
    }
//https://ashwanisoni.wordpress.com/2017/05/02/create-or-update-custom-metadata-type-via-apex-code-salesforce-summer-17/  
}
I am just missing the boat on how to fix this.

Really would appreciate any help.

 
Best Answer chosen by Robert Davis 1
Syed Insha Jawaid 2Syed Insha Jawaid 2

Hi Robert

Custom metadata are a part of application configuration like your workflows,validation,object etc. These can be included in changesets,packages etc. 
They aren't specifically your records for which you would need to add @IsTest(SeeAllData=true) which although is not a good practice .Apex tests can see them.You dont have to create records in your test methods.

For better understanding please check out the link mentioned below :
https://developer.salesforce.com/blogs/engineering/2015/05/testing-custom-metadata-types.html

Cheers
Insha

dietcoladietcola 

Hello, all-

 

One of my field updates uses the TEXT(Date__c) function to convert the date into text.  It prints it in the YYYY-MM-DD format, though, which means it's the only date in our entire Salesforce system that is not in the MM-DD-YYYY format.

 

Is there a way to customize that within the formula editor?

 

You're all life-savers; thank you as always!

Best Answer chosen by Admin (Salesforce Developers) 
dietcoladietcola

Woo-hoo!  This is the best forum day ever.

 

I had to make one tweak and remove the DATEVALUE part, which I'm just posting in case anyone ever needs to refer to this forum in the future.  All credit to shillyer/Sati, though.  =)

 

TEXT(MONTH(Date__c))+"/" +TEXT(DAY(Date__c))+"/" +TEXT(YEAR(Date__c))

 

Thanks so much!!


 

André Chay SondaAndré Chay Sonda 
What I need to activate Environment Hub? 
I can't see the option in any place

I have a trial version of Salesforce Professional Edition. 
I need to have other edition to use it? 

Thanks!
 
Best Answer chosen by André Chay Sonda
Raj VakatiRaj Vakati
environment hub is  Available in Enterprise, Performance, and Unlimited Editions


The Environment Hub lets you connect, create, view, and log in to Salesforce orgs from one location. If your company has multiple environments for development, testing, and trials, the Environment Hub lets you streamline your approach to org management.


Configure the Environment Hub so that users at your company can access the app to create and manage member orgs. Then enable My Domain so that you can connect existing orgs to the hub and create SSO user mappings.​​​​​​​


Sign up from here for testing 

https://developer.salesforce.com/promotions/orgs/dx-signup​​​​​​​


Some usefull links 


https://help.salesforce.com/articleView?id=environment_hub_faq_map.htm&type=5
https://help.salesforce.com/articleView?id=environment_hub_best_practice.htm&type=5
https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/environment_hub_faq_where_install.htm​​​​​​​
Rohit TripathiRohit Tripathi 
I am getting error message while solving this challenge in Trailhead :

To complete this challenge, add a validation rule which will block the insertion of a contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account's shipping postal code (which has the API Name ShippingPostalCode).Name the validation rule 'Contact must be in Account ZIP Code'.
A contact with a MailingPostalCode that has an account and does not match the associated Account ShippingPostalCode should return with a validation error and not be inserted.
The validation rule should ONLY apply to contact records with an associated account. Contact records with no associated parent account can be added with any MailingPostalCode value. (Hint: you can use the ISBLANK function for this check)

Error Message is :  There was an unhandled exception. Please reference ID: HKIZNLVZ. Error: Trailhead::TrailheadTimeOut. Message: Trailhead.view: failed to get a 200 response. Made 3 attempts each resulting in a 403 or 500 failure for url challenges?key=%5B%22trailhead.challenge.validation_rules.en.us.192%22%5D.

I am not sure what went wrong here.
My Validation Rule is on Contact Object  :

  AND ( NOT(ISBLANK( Account.Name)),
( MailingPostalCode <> Account.ShippingPostalCode))

Can anyone please help with this.
Best Answer chosen by Rohit Tripathi
Amit Chaudhary 8Amit Chaudhary 8
Please try below valudation rule
AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode != Account.ShippingPostalCode
)
i Used same and got all points in Trailhead challenge


 
Tyler Brooks 14Tyler Brooks 14 
I'm creating a visualforce page that displays data for confirmation when changes are made to a record and I wanted an email to be triggered when the changes are confirmed/ submitted. I added a picklist to the object and reference it in the page using

<td><apex:inputField value="{!RMA__c.Changes_have_been_review__c}"/>        
            </td>

It shows up fine and has the values from the picklist field but whenever you select your value and hit submit it doesn't update the objects field. 

Any help would be appreciated.

-Tyler
Best Answer chosen by Tyler Brooks 14
karthikeyan perumalkarthikeyan perumal
  Hello, 

1.Using this Example Code save this code as VF page, 
 
<apex:page standardController="Account">
    <apex:form >
        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.site}"/>
                <apex:inputField value="{!account.type}"/>
                <apex:inputField value="{!account.accountNumber}"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Update"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>
2.  preview. can able to view this page. 
3. place ID value in URL as query string . then try to update Type picklist value. 

User-added image

Hope this will help you. 

Thanks
karthik

 
deepakpdeepakp 

Hi All,

 

 

When I use following code I see date in  "Wed Feb 11 00:00:00 GMT 2009" format

 

 

<apex:column width="10%"> <apex:facet name="header"> <apex:commandLink action="{!search}" value="Close Date" id="cmdSort2"> <apex:param value="o.CloseDate" name="column" assignTo="{!sortExpression}" ></apex:param> </apex:commandLink> </apex:facet> <apex:outputLabel value="{!opp.CloseDate}" /> </apex:column>

 

 

When I use 

<apex:column value="{!opp.CloseDate}" width="10%"/>

 

, it displays date in "mm/dd/yyyy" .

 

What I need to do to display date in "mm/dd/yyyy" format using outputLabel?

 

Are there any functions in Visualforce expression to support this..

 

 

 

Thanks,

Deepak

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
SteveAnderson41SteveAnderson41

Can you use apex:outputText instead?

 

 

<apex:page standardController="Opportunity"> <apex:outputText value="{0,date,MM/dd/yy}"> <apex:param value="{!opportunity.CloseDate}" /> </apex:outputText> </apex:page>

 

That should give you the results you want.