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

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.



segunda-feira, 29 de agosto de 2016

iMIS - Force HTTP

iMIS - Force HTTPS

To force HTTP in all the pages, even if the user change the url, it will back to use HTTP in the page.


  
      
        
        
          
          
            
          
          
        
      
    

terça-feira, 31 de maio de 2016

iMIS - C# - Creating an user credential



Here is a piece of code to create an user credential and update the Asp_membership table.


objContact.CreateUserSecurity("username01", "123456");
objContact.UserSecurity.ExpiresOn = DateTime.Parse("01/01/2050");
objContact.UserSecurity.Save();
objContact.Save();
//Don't forge to update the aspnet_membership table. - Otherwise the forget password doesn't work.

MembershipUser objMembership = Membership.GetUser(sEmail);
objMembership.Email = sEmail;
Membership.UpdateUser(objMembership);

iMIS Template - Advice


I will put here all the stuff that I think is important to remember when you create a new iMIS Template and App_Theme.


Importing fonts on iMIS.

Create a CSS file just for fonts that will be loaded as the first css.

10 - Fonts.css

@import url(https://fonts.googleapis.com/css?family=Lato);


20 - Lodon_Responsive.css


If you don't do that, if you add the font in the master page, it won't load when you open a popup such as Register Someone.



sexta-feira, 13 de maio de 2016

iMIS - Error to Edit a Content Page



I was getting the error

Exception information: 
Exception type: ArgumentOutOfRangeException 
Exception message: 
Parameter name: contentItemKey Actual value was 00000000-0000-0000-0000-000000000000. at Asi.Business.ContentManagement.ContentItemCollection.get_Item(Guid contentItemKey) at AsiCommon_Controls_ContentManagement_WebPartLayout.WebPartManager_WebPartMoved(Object sender, WebPartEventArgs e) at AsiCommon_Controls_ContentManagement_WebPartLayout.Page_Load(Object sender, EventArgs e)



This was because the Layout.

If you go to Rise >> Manage Layout
Check others layout and see if those are the same style that you have in your page.

In my case I had tables(td and tr) instead of divs. I put div and it works.

sexta-feira, 22 de abril de 2016

iMIS - Change Password Message


iMIS - Password Message


Change the message "The password must be at least {0} characters long."


20.1.1.4
Rise >> System Settings >> Password requirements text. (PasswordRequirementsText)

20.2
Settings > Contacts > Account Management



quinta-feira, 21 de janeiro de 2016

iMIS - Certificate - HTTPS



Configure IIS

I was getting the error below when I tried to access the Cart Page or any page using HTTPs on iMIS.

This page can’t be displayed or This site can't be reached.



In order to work, I follow this tutorial below, in my case I was working on the dev environment then I created a self certificate.

Source: http://blogs.msdn.com/b/rakkimk/archive/2007/05/25/iis-7-how-to-configure-a-website-for-https.aspx

"

Getting a Web Server Certificate


To get a web server certificate, in IIS 6 manager, you will go into website’s properties àDirectory Security and you will bring the Server Certificate wizard by clicking on the Server Certificate button under Secure communications. But, here in IIS 7, you can select this in a global place in the IIS 7 manager. Follow the below steps for the same:


1. Open the IIS 7 manager.


2. Select the computer name under Connections (in the left hand side).


3. Select the Features View and double click on the “Server Certificates” feature.


4. You will find options to create a Certificate request, Complete Certificate Request, Create Domain Certificate and Create Self-Signed Certificate under the Actionspane (in the right hand side).


5. For this example, lets create a self signed certificate – Click on “Create Self-Signed Certificate…”.


6. Specify a friendly name for the certificate and click on OK.


7. Our self-signed certificate will be created and ready to use.


Configuring the SSL port for a website


In IIS 6 manager, you will go into website’s properties and give the port number in the SSL port textbox. But, here in IIS 7, it is little different. Follow the below steps for the same:


1. Open the IIS 7 manager.

2. Select the website under Connections (in the left hand side).

3. Click on Bindings under the Actions pane (in the right hand side).

4. Now, click on Add.

5. Select the type as https and enter the Port – default will be 443.

6. You cannot click on the OK button till you select the SSL certificate for the site.

7. If you haven’t installed any server certificate, you won’t see any certificate listed in the drop down box. To get a server certificate, please follow the above steps under “Getting a Web Server certificate”.

8. Select the certificate and click on OK.


Now, your website is configured for SSL and it will be accessible via https. But, you may see some certificate related errors since this is a self-signed certificate."




After the Tutorial above, you can add the Certificate on iMIS.














sexta-feira, 11 de dezembro de 2015

jQuery - Only Numbers


jQuery - Only Numbers in the input(textbox) field.

jQuery code that changes the input to accept just numbers.

How it looks like:

http://jsfiddle.net/rogeriohsjr/cye3Lh33/

Code Example:

jQuery(document).ready(function () {

    ApplyNumberAllFields();

});

function ApplyNumberAllFields() {

    var objListValue = GetFields();

    for (var i = 0; i != objListValue.length; i++) {

        jQuery(objListValue[i]).keypress(function (event) {
            return /\d/.test(String.fromCharCode(event.keyCode));
        });
    }
}


function GetFields() {
    var objListObjects = [];

    objListObjects.push("#txtNumber1");
    objListObjects.push("#txtNumber2");
    objListObjects.push("#txtNumber3");

    return objListObjects;
}


domingo, 6 de dezembro de 2015

Tags to Post

Tags to use on the blog.

C#
<pre class="brush:csharp">

HTML, XML
<pre class="brush:xml">
<pre class="brush:html">

CSS
<pre class="brush:xml">

SQL
<pre class="brush:sql">


Source: http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/

Interesting Websites

My bookmarks. =)

Here we can find some of my favorite links.


Regular Expression
Link: http://tools.netshiftmedia.com/regexlibrary/#
Comments: Website that executes Regular expression.
Tags: exp

Join Me (Free)
Link: https://www.join.me/
Comments: Website for you have a meeting.
Tags: Meeting

JSFiddle
Link: http://jsfiddle.net/
Comments: Website for you create your script and execute.
Tags: Javascript, jQuery.

Tutorial Point
Link: http://www.tutorialspoint.com/index.htm
Comments: There is a lot of good tutorials and also you can execute your code.

ColorHexa
Link: http://www.colorhexa.com/7c7064
Comments: Discover the colour your are looking for by using many types such as RGB, #45678
Tags: CSS, Color

Best CSS Button Generator
Link: http://www.bestcssbuttongenerator.com
Comments: The name says for itself, really nice tool to create a design.
Tags: CSS, Color

iMIS

iMIS Documentation, Manual
http://www.advsol.com/ASI/SupportPortal/SupportPortal/Documentation_archives.aspx
Comments: Some of the documentation from iMIS, all the versions.

iMIS Community
http://www.imiscommunity.com/
Comments: iMIS Forum

iMIS Objects
http://www.imiscommunity.com/imiscommunity/docs/ibonet/api/index.html
Comments: List of Objects on the iMIS iBO, some descriptions.