• Avinash Angasay
  • NEWBIE
  • 40 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 3
    Replies
Task--->I have done the Below Requirement with the help of Html+JavaScript Successfully.But Now I Want to do this With the help of LWC.
how to Rander the Html Template for Images using Javascript in Lwc for display or hidden...??
Consider the images I have Used in my code..

Just First Look Below what i have done and what is the Requeirement....

Requeirement--->
Create an input fields with name 'Speed'.
Create a Button with Name 'Calculate'.
Limit of speed lies between 0 to 100
We need to display 3 images On UI which are having Signs as 'Safe','Warning' and 'Danger'  on the basis of some Condition.
Initially all images are hidden.
0 to 40   - 'Safe' sign image 
40 to 60  - 'Warning' sign image
60 to 100 - 'Danger' sign image
if spped is below 40 then it should display safe image.
if someone put 50 and click on calculate then warning image should display.
if speed is between 60 to 100 then it should display Danger image.

We need to show or hide images in that particulr way

I have written Code in simple Html -JavaScript and Successfully done the Task--
<html>
    <head>
        <title>
             Speed Page
        </title>
    </head>
    <body>
       
    <label>Speed</label>
    <input type="text" id = 'Speed'>
    <button onclick="handleClick()">calculate</button>
    <img src="https://5.imimg.com/data5/NJ/KM/MY-19300535/safety-danger-sign-board-500x500.jpg"
    alt="Trulli" width="500" height="333" style="display:none;" id="theImage">
   
    <img src="https://as1.ftcdn.net/v2/jpg/04/09/61/02/1000_F_409610233_1DTKcm2vZhOdXlT9lWtCjkX7foRwnoaf.jpg"
    alt="Trulli" width="500" height="333" style="display:none;" id="theImage1">
   
    <img src="https://cdn.jjkeller.com/wcsstore/CVCatalogAssetStore/images/product/500x500/8002485.jpg"
    alt="Trulli" width="500" height="333" style="display:none;" id="theImage2">
    </body>
    <script>
        function handleClick()
        {
            var Speed1 = document.getElementById('Speed');
           
            if(parseInt(Speed1.value) > 0 && parseInt(Speed1.value)<40)
            {
                document.getElementById("theImage2").style.display = "block";
                document.getElementById("theImage1").style.display = "none";
                document.getElementById("theImage").style.display = "none";
            }
            else if(parseInt(Speed1.value) >40 && parseInt(Speed1.value)<60)
            {
                document.getElementById("theImage2").style.display = "none";
                document.getElementById("theImage1").style.display = "block";
                document.getElementById("theImage").style.display = "none";
            }
            else if(parseInt(Speed1.value) >60 && parseInt(Speed1.value)<100)
            {
                document.getElementById("theImage").style.display = "block";
                document.getElementById("theImage1").style.display = "none";
                document.getElementById("theImage2").style.display = "none";
            }
            else if(parseInt(Speed1.value)>100)
            {
                document.getElementById("theImage").style.display =  "none";
                document.getElementById("theImage1").style.display = "none";
                document.getElementById("theImage2").style.display = "none";
            }
        }
    </script>
</html>




Thank You in Advance
Q->  Insert 100 student’s records. Rollback all the inserted records if the number of successful insertion is less than 80
Delete those Accounts who have more than 2 opportunities

If anyone Can write query for it.....
I got problem  While deleting Account...\
I have written code like below---
but when i  want to delete account at the end then it will not get deleted it is saying that account have cases...what to do now...how to process it forward from here in code for deleting these account records who has opportunities grater than 2 with them.....

  List<Account> aList = [Select Name,(Select Name from Opportunities) from Account];
         List<Account> delAcc = new List<Account>();
         for(Account a:alist)
         {
           if(a.Opportunities.size()>2)
           {
               system.debug(a.Opportunities.size());
               delacc.add(a);
           }
         }
         system.debug(delacc);
         delete delacc;
    } 
Please write code for the below problem....
Insert 5 records in Account object and display the list of records which are successfully inserted.Create related contact and opportunity to those successful accounts and add an opportunity product to those opportunity.. Using dml...
how to add opportunity product to opportunity
Thank you in advance
1.) Get all the opportunities,contacts,notes related to an Account where Account Name starts with ‘B’.
Ans -select id,Name,(select id, Name,StageName From Opportunities), (Select id from Notes) ,(Select LastName from Contacts) from Account where Name like 'B%'
 
2.) Get the account name,notes,contacts related to an opportunity where opportunity name ends with ‘A’.
Ans-select id,Name,Account.name, (Select id from Notes) ,(Select id from OpportunityContactRoles) from Opportunity where Name like '%A'


Create a map for above,use the queries of  - create all the maps asked below-
Where key will be the account id and list of records as value. It should be like this,
Create 3 maps for opportunities, contacts and notes: Map> Map> Map>
Please write queries for these below problems using Sosl and Soql........

How to access notes related to account.
how to compare close date and fiscal year in Sosl.

Thank you in advance..
 
1.) Get all the opportunities,contacts,notes related to an Account where Account Name starts with ‘B’.
 
2.) Get the account name,notes,contacts related to an opportunity where opportunity name ends with ‘A’.
 
3.) Get all the records where field consist ‘Test’ and close date of opportunity records should be of this fiscal year, accounts should be owned by current logged in.
Delete those Accounts who have more than 2 opportunities

If anyone Can write query for it.....
I got problem  While deleting Account...\
I have written code like below---
but when i  want to delete account at the end then it will not get deleted it is saying that account have cases...what to do now...how to process it forward from here in code for deleting these account records who has opportunities grater than 2 with them.....

  List<Account> aList = [Select Name,(Select Name from Opportunities) from Account];
         List<Account> delAcc = new List<Account>();
         for(Account a:alist)
         {
           if(a.Opportunities.size()>2)
           {
               system.debug(a.Opportunities.size());
               delacc.add(a);
           }
         }
         system.debug(delacc);
         delete delacc;
    } 
Please write code for the below problem....
Insert 5 records in Account object and display the list of records which are successfully inserted.Create related contact and opportunity to those successful accounts and add an opportunity product to those opportunity.. Using dml...
how to add opportunity product to opportunity
Thank you in advance
Please write queries for these below problems using Sosl and Soql........

How to access notes related to account.
how to compare close date and fiscal year in Sosl.

Thank you in advance..
 
1.) Get all the opportunities,contacts,notes related to an Account where Account Name starts with ‘B’.
 
2.) Get the account name,notes,contacts related to an opportunity where opportunity name ends with ‘A’.
 
3.) Get all the records where field consist ‘Test’ and close date of opportunity records should be of this fiscal year, accounts should be owned by current logged in.