quinta-feira, 26 de abril de 2018

Salesforce - Error to push new version into an Org due Encrypt Field

This week, we got an error to upgrade a new version into a customer org. The error shows that we didn't have kind of access to LastName field, but I could not duplicate the issue if I removed access in that table.

 "classes/XController.cls SELECT Id FROM Contact WHERE LastName = 'X 1' limit 1 ^ ERROR at Row:1:Column:30 field 'LastName' can not be filtered in a query call classes/XController.cls SELECT Id FROM Contact WHERE LastName = 'X 1' limit 1 ^ ERROR at Row:1:Column:30 field 'LastName' can not be filtered in a query call classes/X.cls SELECT Id FROM Contact WHERE LastName = 'test 1' limit 1 ^ ERROR at Row:1:Column:30 field 'LastName' can not be filtered in a query call classes/X.cls SELECT Id FROM Contact WHERE LastName = 'test 0' limit 1 ^ ERROR at Row:1:Column:30 field 'LastName' can not be filtered in a query call"


First I did some research and I found this Forum which I thought could be something related with encryption. In the end I contacted Salesforce and they said the customer has marked the field to encrypt and then unmarked the field, when it happens the customer should contact Salesforce so then can run a "historical data decrypt", because the customer didn't contact SF, we got into this issue. After they run that we could upgrade the customer.

segunda-feira, 16 de outubro de 2017

Git - Commands








Deleting local branch and updating with Remote branch.

git reset --hard origin/master
Source:
https://stackoverflow.com/questions/9210446/replace-local-branch-with-remote-branch-entirely

quinta-feira, 28 de setembro de 2017

Salesforce - Delete list of Attachment



Developer Console >> Debug >> Open execute Anonymous Window


List<Attachment> ListAttachments =
    [SELECT id from Attachment];

System.debug(
    ListAttachments.size()
);

delete ListAttachments;





Deleting Cases and Contacts


List<Case> ListCases =
    [SELECT id from Case];

System.debug(
    ListCases.size()
);

delete ListCases;


List<Contact> ListContacts =
    [SELECT id from Contact];

System.debug(
    ListContacts.size()
);

delete ListContacts;

quarta-feira, 13 de setembro de 2017

Salesforce - Days Since Last Update is empty - Use Formula Fields

Today I was doing trailhead "Use Formula Fields" and I got stuck where the formula wasn't showing any result.

The issue was because I didn't have any Account with Last Activity. I just had to go to an Account and in the Activity History section I clicked on Log a call, and saved it. After that you are good to go, you should see one Case record with Days Since Last Update as empty.

quinta-feira, 7 de setembro de 2017

Salesforce - Lightning - Redirect to a specif Page

From:

PageReference newpage = new PageReference('/apex/MyPage');
newpage.setRedirect(true); return newpage;

To: PageReference newpage = new PageReference('/one/one.app#/n/MyPage'); newpage.setRedirect(true);

 return newpage;




    function FF_GetVisualforcePageURL(pPage, pNamespace){
        var vLightning = '';
        if ((typeof sforce != 'undefined') && sforce && (!!sforce.one)) {
            vLightning = '/one/one.app#/alohaRedirect'
        }
       
        return vLightning + '/apex/' + pNamespace + pPage
    }

quarta-feira, 23 de agosto de 2017

Salesforce - Error when try to deploy - Invalid field:VERSION.TITLE in related

Error: Invalid field:VERSION.TITLE in related list:ContentDocumentRelatedList

 


Solution:

From the Layout that I added the ContentDocument List, I had to removed it from there. It could happen because the environment which I'm using is Developer org and the other one that I'm publishing is not.