Saturday, 9 February 2019

How to Play YouTube Video In Salesforce Lightning Component


We can play video file in lightning component by 2 ways :


  • From Static Resources.
  • Play Video File Using iFrame Tag.
<aura:component>

  <iframe width="720" height="480" src="https://www.youtube.com/embed/45JRuZOBIKk"></iframe>

</aura:component>


<aura:application>
    <c:videoDemo/>
<!-- here c: is org. default namespace prefix-->
</aura:application>


How To Detect a Device In Salesforce Lightning Component ?


{!$Browser.isTablet}      > To detect the tablet device
{!$Browser.isPhone}      > To detect the user is in Mobile Phone / mobile browser
{!$Browser.isAndroid}   > To detect the user is in Android device
{!$Browser.formFactor} > Returns a FormFactor enum value based on the type of hardware the browser is                                                            running on.


DetectDevice.cmp

<aura:component>

    <aura:if isTrue="{!$Browser.isTablet}">
    You are using a tablet device
        ( <lightning:icon iconName="utility:tablet_portrait" size="x-small" alternativeText="Indicates approval"/> ).
    </aura:if>
    <aura:if isTrue="{!$Browser.isPhone}">
        You are using a phone
        ( <lightning:icon iconName="utility:phone_portrait" size="x-small" alternativeText="Indicates approval"/> ).
        This message is rendered using isPhone <br />
    </aura:if>
    <aura:if isTrue="{!$Browser.isIPhone}">
        You are using an IPhone, If it is IPhone X, _/\_ <br />
    </aura:if>
    <aura:if isTrue="{!$Browser.formFactor == 'DESKTOP'}">
    You are using a DESKTOP
        ( <lightning:icon iconName="utility:desktop" size="x-small" alternativeText="Indicates approval"/> )
        Browser device
    </aura:if>
    <aura:if isTrue="{!$Browser.formFactor == 'PHONE'}">
    You are using a Phone, This message is rendered using formFactor
    </aura:if>
    <aura:if isTrue="{!$Browser.formFactor == 'TABLET'}">
    You are using a Table device
    </aura:if>
</aura:component>


<aura:application extends="force:slds">
    <c:DetectDevice />
</aura:application


var device = $A.get("$Browser.formFactor");

Saturday, 2 February 2019

                                     DATALOADER:






A. Log In Issues: Are You Timed Out?

If you leave the Data Loader running on your machine, it will time out in the number of seconds you have defined in the Settings:If the Data Loader has timed out, and you try to perform another operation with it, you will receive a message like this one:
The message looks a bit ominous, and if you are seeing it for the first time

B. Are you logging into sandbox or production?-check server host url properly(https://test.salesforce.com for a sandbox org and https://login.salesforce.com for a production org)

C.Log In Issues: Do you need a security token?

Unless your IP address is trusted by the Salesforce org you are trying to log into, you will need to add your security token to the end of your password in order to log into the Data Loader.

Keep track of your security tokens – you need one for each production org and each sandbox org for which your IP address is not trusted.

Either add your security token to the end of your password string, or trust your IP address. Be careful trusting IP addresses – doing so reduces the protection on your Salesforce org.

To trust your IP address, obtain the IP address from your system. Then, in Salesforce, under Administration Setup => Security Controls =>Network Access, enter your IP Address as the Start IP Address and End IP Address, or enter a range that includes your IP Address.


Loading Null Values into Fields

Sometimes you may need to use the Data Loader to “null out” a value and load blank values for one field for one or more records.

In the Data Loader, select Insert null values. It is recommended that you only select this option when you specifically intend to insert null values. 

Don’t leave it selected because you may inadvertently erase data if you map a blank column to a field when you are data loading.


Loading Data When Same Record is Updated More than Once

The Data Loader limits the number of records you can update with an upsert in the same batch. If you try to upsert the same record more than time in the same batch, you will receive an error message like one of the following:

duplicate value found: unknown duplicates value on record with id: a044000000HpfNS

Duplicate external id specified: 12345


Depending on the situation, the data you are trying to load may need to be analyzed, for example, to determine the most recent update, or some other criterion of precedence.

However, if you know that all the upserts need to be loaded, you can eliminate this obstacle by reducing the Data Loader batch size to one. Each record will then load, regardless of whether that record was already upserted earlier in the data load.


Show All Salesforce Objects

The Data Loader defaults to showing the most common standard objects and your org’s custom objects when you insert/update/upsert/delete/export.

However, there are other objects that you can access by selecting Show all Salesforce objects when you begin your data loader operations.

Using Data Loader to Write SOQL Queries

When you delete/export Salesforce records using the Data Loader, you are performing a SOQL query. The generated query appears at the bottom of the Data Loader dialog. Add filters to the query by first selecting from the fields in object you are querying, and then selecting an operation and choosing a value.

Account: id value of incorrect type: #N/A

This example error is for the Account object, but where the error reads “Account,” it could be any standard or custom Salesforce object. The word(s) after the colon in this error refer to what was found in the column mapped to the Account ID – in this case, the column for Account read “#N/A.” This value is typical of using a vlookup function in Excel to build your data load file and getting no results for this row.

There is no way to update a Salesforce record without its Salesforce ID. If you have values for another field on the object that is defined as a foreign key (or “unique identifier” in Salesforce), you can use that field to upload data, but you have to perform an upsert.

Error converting value to correct data type: Failed to parse date: N/A

Error converting value to correct data type: Failed to parse date: 00:00.0

The above are two examples of errors when the data being mapped is not of the correct format for the date field to which it is being mapped. You can tell by what follows the colon in the error; this is what the Data Loader is finding and trying to map to a date. See above for help with Date/Time format.

Insufficient access rights on cross-reference ID

Insufficient access rights messages pertain to the owner of the record that is being modified. So, if you are loading an owner ID (using the Salesforce ID of someone’s User record), then that person has insufficient access (permission) to what you are trying to insert or update.

If you are not loading an Owner ID for the records, then you (the user logged into the Data Loader) do not have permission to insert or update. If you are a System Admin, check for the following:

An unassigned record type for the object (it must be one of the record types for that object that is assigned to your profile in order for you to be able to create records of that record type)
An inactive record type for the object
A field that it is read-only for the System Admin profile (it may be read-only for all profiles)
Similarly, if you see this error:

Record Type ID: this ID value isn’t valid for the user

Check to make sure:

Is it active?
Does the record owner’s profile have access to the record type?
Is the ID correct for record type – no typos, or other errors in the string?
Invalid cross-reference ID

This error is related to the other ID errors. It indicates that you are trying to load some value (or a blank value) for an external ID for a custom object that does not exist for any record in that object. For example, trying to load a reference to Contact with “9013133” as a Student_ID__c (where Student_ID__c is defined as a unique external ID for Contact) when you don’t have a Contact in your org with that Student_ID__c value.

It is also possible that the user performing the load does not have access to the Student_ID__c field (in the example). To check on this second possibility, manually try to access one of the Contact records with one of the Student_ID__c values that is giving this error, such as by building a view of Contacts with Student_ID__c = “9013133” (which should return exactly one Contact if you have access to the field and that value exists for one of the Contact records.

npe01.IndividualAccounts: execution of BeforeInsert

Any error message that references BeforeInsert, BeforeUpdate, or another Apex operation is most likely being triggered by some existing code in your organization. Review the code base for the object to which you are trying to insert or update records.

If there is a Foreign Key, you must include a Legacy System ID.

Sometimes the error is caused by existing validation rules in your Salesforce org. To recognize such errors, use consistent language for your validation rule error messages and if you need to be able to load data – for example, legacy data – that does not have to be consistent with validation rules, consider making an exception to the validation rule, such as a Custom Setting that keeps it from running when the user is the System Administrator.



Links:

https://www.salesforcetutorial.com/salesforce-data-loader/