+ Start a Discussion
Sachin Bhalerao 17Sachin Bhalerao 17 

Lightning components require My Domain. Please contact your system administrator for more information.

Hello Team ,

I newly created one salesforce instance but after previewing my application m getting this error on web browser :

Lightning components require My Domain. Please contact your system administrator for more information.

Please let me know what to do next i have to wait for some time or some error is thr
Khan AnasKhan Anas (Salesforce Developers) 
Hi Sachin,

Greetings to you!

You must deploy My Domain in your org if you want to use Lightning components in Lightning tabs, Lightning pages, as standalone apps, as actions and action overrides, as custom Lightning page templates, or elsewhere in your org.

When My Domain isn’t deployed in your org, user interface controls related to Lightning components may be hidden or inactive. Lightning components added to pages, tabs, and so on, don’t run and may be omitted, or display a placeholder error message.

Please refer to the below links which might help you further.

https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/environment_hub_get_started_my_domain.htm

https://sfdctechie.wordpress.com/2018/11/12/why-my-domain-required-for-lightning/

https://help.salesforce.com/articleView?id=domain_name_overview.htm&type=5 (https://help.salesforce.com/articleView?id=domain_name_overview.htm&type=5)

https://help.salesforce.com/articleView?id=faq_domain_name.htm&type=5 (https://help.salesforce.com/articleView?id=faq_domain_name.htm&type=5)

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Sachin Bhalerao 17Sachin Bhalerao 17
Hi Anas ,

I am working on Objective type test project . I have to built it on Lightning component . I post my question on forum and i got this solution :

Create a custom object with custom fields of type picklist with the default value as the correct answer.
On lightning component, show the values in lightning:radiogroup.
On Submit button, send the data to save the record and check the values selected with those of default (correct) values, if it matches add 1 else add 0, and show the result on Save on a pop-up (modal) window.

I wrote following code but no output . Please give me this solution to acheive this functionality :

 
Component :

<aura:component controller="BISPController">
            <aura:attribute name="NewCon"  

            type="Contact"

            default="{ 'sobjectType': 'Questions__c',

                     
                     
                     'Does_Lightning_Component_uses_Javascript__c    ' : '',
                     
                     'Which_file_not_part_of_lightning_comp__c' : '',}" />
    
      <form>
                 <div class="slds-form-element">
          <div class="slds-form-element__control">
              <label class="slds-form-element__label" for="form-element-01">Does Lightning Component uses Javascript</label>
            <div style="background-color:white; height:33px; border:solid; border-color:rgb(217,219,221); border-radius:4px;">
                  <force:inputField value="{!v.NewCon.Does_Lightning_Component_uses_Javascript__c    }" class="form-control" />
              </div>
               
    </div>
  </div>  
          
          <div class="slds-form-element">
          <div class="slds-form-element__control">
              <label class="slds-form-element__label" for="form-element-01">Which file not part of lightning comp</label>
            <div style="background-color:white; height:33px; border:solid; border-color:rgb(217,219,221); border-radius:4px;">
                  <force:inputField value="{!v.NewCon.Which_file_not_part_of_lightning_comp__c}" class="form-control" />
              </div>
               
    </div>
  </div>          
           </form>
    
</aura:component>

APEX class

public with sharing class BISPController {

        @AuraEnabled

public static Questions__c Submitans (Questions__c con) {

    upsert con;

    return con;

}
}

Lightning APP

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

Visual force page

<apex:page controller="BISPController">
      
 <apex:includeLightning />
<apex:pageBlock >
     <apex:pageBlockSection >
           <div id="Con" />
    </apex:pageBlockSection>
     </apex:pageBlock>
      

         <script>
  
            $Lightning.use("c:submitAns", function() {
                
              
                $Lightning.createComponent(

                    "c:Questions",

                    {},

                    "Con",

                    function(cmp) {

                        console.log("Component is created!");

                        console.log(cmp);

                    });

                });

        

          </script>

</apex:page>


controller.js

({

    save : function(component, event) {

            var getCon = component.get("v.NewCon");

            var action = component.get("c.Submitans");

            action.setParams({ 

                "con": getCon

            });

            action.setCallback(this, function(a) {

                   var state = a.getState();

                 if (state === "SUCCESS") {

                        var name = a.getReturnValue();

                       }

                });

            $A.enqueueAction(action)

    }

    })