quinta-feira, 7 de fevereiro de 2019

Salesforce DX - Shortcuts

Some of the salesforce dx commands that I use often.


// Setup an org and give a alias for it.
sfdx force:auth:web:login -a Dev2

//This creates a org and install a package
vTries=1159 &&
vVersion=v358 &&
vPackageID=XXXXXXX &&
sfdx force:org:create -f config/test-enterprise.json -a 'Enterprise-'$vVersion -v DevHub &&
sfdx force:user:create --targetusername 'Enterprise-'$vVersion --setalias 'qa-user-'$vVersion --definitionfile config/user-admin.json Username=$vTries'qafs-'$vVersion'@xxtest.ca' &&
sfdx force:user:password:generate -u 'qa-user-'$vVersion &&
sfdx force:package:install --targetusername 'qa-user-'$vVersion --package $vPackageID --wait 3 --noprompt &&

sfdx force:org:open --targetusername 'qa-user-'$vVersion --path lightning &&
sfdx force:org:display -u 'qa-user-'$vVersion



sábado, 9 de junho de 2018

Salesforce error STORAGE_LIMIT_EXCEEDED



When we try to do an operation in salesforce we can get this message:

Insert failed. First exception on row 0; first error: STORAGE_LIMIT_EXCEEDED, storage limit exceeded: [] 
An unexpected error has occurred. Your development organization has been notified.

This happens because we have reach the Salesforce limit for Storage. You can check it on :
Setup >> Storage Usage




My Case I had to clean some objects, so I run this script.


List<attachment> ListObjects =
    [SELECT id from attachment];

System.debug(
    ListObjects.size()
);

Database.delete(ListObjects, false);

ListObjects =
    [SELECT id from attachment];

System.debug(
    ListObjects.size()
);

Clean the Bin as well
Home >> Recycle Bin >> Empty Your organization's recycle bin

segunda-feira, 21 de maio de 2018

Publishing from Mac into a hosting (SmarterASP.NET)


This example, I will show how I did to publish the .Net Core that I build in my mac to a smartasp.net hosting.

In your terminal, you should be in new-project folder. There you should run:

dotnet publish --output publish

Source: 
https://jonhilton.net/2016/08/18/publishing-your-net-core-web-app/
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish?tabs=netcore2x

Pushing .net core from your local host into your hosting using terminal.

We won't use FTP because you can't upload all the files and folder at once. We will use NCFTP but this one you should not use in a public place because it is not using ftps.

In you terminal in any folder type command below to install brew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Source: https://brew.sh/

Now let's install NCFTP, in your terminal type:

brew install ncftp

Let's connect into the server using ncftp

Access your publish folder, if you are in new-project folder go to publish folder.

cd publish

Then type this command to upload all the files and folder.


ncftp -u yourFTPusername -p yourPWUsername ftp://ftp.yourftpsite.net/site2

put -R *

It should upload all your files into the Site2 directory in my case.

If you go to your host url you should be able to see your site up.


Observations:
- We are using ncftp, this is not safe because it does not have FTPS. You can use any other ftp. I didn't research so much but if you know any other ftp that is safe and easy to setup let me know.


Learning .Net Core - Using mac to build an Single Page Application in .Net Core

I am not going to explain each stuff because I don't know and I am learning as well, here are the commands that take me to start one .Net Core Vue application and publish it on smartasp.net.

For more details on what are you doing read the sources.

1. Install .Net
1.1. Go to https://www.microsoft.com/net/download/macos
1.2. Download .Net Core and Visual Studio.
I installed Visual Studio and .Net Core SDK to try. But I guess if we use only VS code we don't need to install Visual Studio.
1.3. Check if .Net core is installed, open the terminal and type:
dotnet --version

You should see the version dotnet version on my case it shows 2.1.4

2. Creating a new project using SPA(Single Page Application) templates.
Source: "Building Single Page Applications on ASP.NET Core with JavaScriptServices"

2.1. Let's create a vue project, in your terminal, go to the folder that you would like to create your projects. In my case I was on Documents/Project, then I typed:

mkdir new-project
cd new-project
dotnet new vue
npm install


3. Running the app, in your terminal type:

dotnet run

Source: Microsoft - dotnet run

After you see the "Request finished in xxxx 404" you can open localhost.


http://localhost:5000

You should see the template example right now.

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