• Thiago Barbosa 10
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 3
    Replies
<div aura:id="error-toast-container" class="slds wr-toast-container wr-toast-container-format slds-hide" >
		<div aura:id="error-toast" class="slds-notify slds-notify_toast wr-toast-format" role="alert">
                <span aura:id="iconToast" class="slds-hide slds-icon_container slds-icon-utility-error slds-m-right_small slds-no-flex slds-align-top">
                    <lightning:icon iconName="utility:warning"/>
                </span>
			<div class="slds-notify__content">
				<h2 class="slds-text-heading_small">
					<lightning:formattedText value='{!v.errorMessage}'/>  
					<lightning:button aura:id="addLine" class="slds-hide wr-destructive-link-format" variant="" onclick="{!c.onReadMore}">{!$Label.c.ReadMore}</lightning:button> 
				</h2> 
			</div>
			<lightning:buttonIcon variant="bare" class="slds-notify__close slds-button_icon-inverse" title="Close" iconName="utility:close" onclick="{!c.closeToast}" size="large">
			</lightning:buttonIcon>
		</div>
	</div>
=================================================================

 onReadMore : function(component, event, helper){ 
        $A.util.addClass(component.find('error-toast-container'), 'slds-hide');
    }

 
<div aura:id="error-toast-container" class="slds wr-toast-container wr-toast-container-format slds-hide" >
		<div aura:id="error-toast" class="slds-notify slds-notify_toast wr-toast-format" role="alert">
                <span aura:id="iconToast" class="slds-hide slds-icon_container slds-icon-utility-error slds-m-right_small slds-no-flex slds-align-top">
                    <lightning:icon iconName="utility:warning"/>
                </span>
			<div class="slds-notify__content">
				<h2 class="slds-text-heading_small">
					<lightning:formattedText value='{!v.errorMessage}'/>  
					<lightning:button aura:id="addLine" class="slds-hide wr-destructive-link-format" variant="" onclick="{!c.onReadMore}">{!$Label.c.ReadMore}</lightning:button> 
				</h2> 
			</div>
			<lightning:buttonIcon variant="bare" class="slds-notify__close slds-button_icon-inverse" title="Close" iconName="utility:close" onclick="{!c.closeToast}" size="large">
			</lightning:buttonIcon>
		</div>
	</div>

============================================================
Controller : 

onReadMore : function(component, event, helper){  
        $A.util.addClass(component.find('error-toast-container'), 'slds-hide');
    }

 
<div aura:id="error-toast-container" class="slds wr-toast-container wr-toast-container-format slds-hide" >
		<div aura:id="error-toast" class="slds-notify slds-notify_toast wr-toast-format" role="alert">
                <span aura:id="iconToast" class="slds-hide slds-icon_container slds-icon-utility-error slds-m-right_small slds-no-flex slds-align-top">
                    <lightning:icon iconName="utility:warning"/>
                </span>
			<div class="slds-notify__content">
				<h2 class="slds-text-heading_small">
					<lightning:formattedText value='{!v.errorMessage}'/>  
					<lightning:button aura:id="addLine" class="slds-hide wr-destructive-link-format" variant="" onclick="{!c.onReadMore}">{!$Label.c.ReadMore}</lightning:button> 
				</h2> 
			</div>
			<lightning:buttonIcon variant="bare" class="slds-notify__close slds-button_icon-inverse" title="Close" iconName="utility:close" onclick="{!c.closeToast}" size="large">
			</lightning:buttonIcon>
		</div>
	</div>

 
/**
* @name TestDataFactory
* @description Contains methods to construct and/or validate commonly used records
**/

public with sharing class TestDataFactory {
    
    /**
* @name ConstructCollaborationGroup
* @description
**/
    
    public static CollaborationGroup ConstructCollaborationGroup(){
        //ToDo: Ensure this method returns a single Chatter CollaborationGroup
        //    whose Name starts with 'TEST' followed by the INVENTORY_ANNOUNCEMENTS constant
        //    and configured so anyone can join, see and post updates.
        CollaborationGroup chatterGroup = new CollaborationGroup(
            Name = 'TEST3'+Constants.INVENTORY_ANNOUNCEMENTS,  
            CollaborationType = 'Public'
        );
        return chatterGroup;
    }
    
    /**
* @name CreateProducts
* @description Constructs a list of Product2 records for unit tests
**/
    public static List<Product2> ConstructProducts(Integer cnt){
        //ToDo: Ensure this method returns a list, of size cnt, of uniquely named Product2 records
        //  with all the required fields populated
        //  and IsActive = true
        //  an Initial Inventory set to 10
        //  and iterating through the product family picklist values throughout the list.
        List<Product2> products = new List<Product2>();
        for(Integer i = 1; i<=cnt ; i++){
            Product2 prod = new Product2(Name='Product'+i, Initial_Inventory__c = 10, isActive=true, family= Constants.PRODUCT_FAMILY.get(math.mod(i,4)).getValue());
            products.add(prod);
        }
        
        return products;
    }
    
    /**
* @name CreatePricebookEntries
* @description Constructs a list of PricebookEntry records for unit tests
**/
    public static List<PriceBookEntry> ConstructPricebookEntries(List<Product2> prods){
        //ToDo: Ensure this method returns a corresponding list of PricebookEntries records
        //  related to the provided Products
        //  with all the required fields populated
        //  and IsActive = true
        //  and belonging to the standard Pricebook
        
        List<PriceBookEntry> entries = new List<PriceBookEntry>();
        for(Product2 prod : prods) {
            PriceBookEntry entry = new PriceBookEntry();
            entry.Pricebook2Id = Constants.STANDARD_PRICEBOOK_ID;
            entry.Product2Id = prod.Id;
            entry.UnitPrice = 100;
            entry.IsActive = true;
            entries.add(entry);
        }
        
        return entries;
    }
    
    /**
* @name CreateAccounts
* @description Constructs a list of Account records for unit tests
**/
    public static List<Account> ConstructAccounts(Integer cnt){
        //ToDo: Ensure this method returns a list of size cnt of uniquely named Account records
        //  with all of the required fields populated.
        List<Account> accounts = new List<Account>();
        for(Integer i = 0 ; i<cnt; i++) {
            Account acc = new Account(name='Account' + i);
            accounts.add(acc);
        }
        System.debug('account size' + accounts.size());
        return accounts;
    }
    
    /**
* @name CreateContacts
* @description Constructs a list of Contacxt records for unit tests
**/
    public static List<Contact> ConstructContacts(Integer cnt, List<Account> accts){
        //ToDo: Ensure this method returns a list, of size cnt, of uniquely named Contact records
        //  related to the provided Accounts
        //  with all of the required fields populated.
        List<Contact> contacts = new List<Contact>();
        for(Integer i=0; i<cnt;i++) {
            Integer index = Math.mod(i, accts.size());
            Contact con = new Contact();
            con.LastName = 'TestContact'+i;
            con.AccountId = accts.get(index).Id;
            contacts.add(con);
        }
        System.debug('contacts size' + contacts.size());
        System.debug('accts size' + accts.size());
        return contacts;
    }
    
    /**
* @name CreateOrders
* @description Constructs a list of Order records for unit tests
**/
    public static List<Order> ConstructOrders(Integer cnt, List<Account> accts){
        //ToDo: Ensure this method returns a list of size cnt of uniquely named Order records
        //  related to the provided Accounts
        //  with all of the required fields populated.
        List<Order> orders = new List<Order>();
        for (Integer i=0; i <cnt ; i++) {
            Order ord = new Order();
            ord.AccountId = accts.get(math.mod(i, accts.size())).Id;
            ord.Pricebook2Id = Constants.STANDARD_PRICEBOOK_ID;
            ord.Status='Draft';
            ord.EffectiveDate = System.today();
            orders.add(ord);
        }
        return orders;
    }
    
    /**
* @name CreateOrderItems
* @description Constructs a list of OrderItem records for unit tests
**/
    public static  List<OrderItem> ConstructOrderItems(integer cnt, list<pricebookentry> pbes, list<order> ords){
        //ToDo: Ensure this method returns a list of size cnt of OrderItem records
        //  related to the provided Pricebook Entries
        //  and related to the provided Orders
        //  with all of the required fields populated.
        //  Hint: Use the DEFAULT_ROWS constant for Quantity as it will be used in the next challenge
        List<OrderItem> items = new List<OrderItem>();
        for(Integer i = 0; i <cnt; i++) {
            OrderItem ord = new OrderItem();
            ord.PricebookEntryId = pbes.get(math.mod(i, pbes.size())).Id;
            ord.OrderId = ords.get(math.mod(i, ords.size())).Id;
            ord.Quantity = Constants.DEFAULT_ROWS;
            ord.UnitPrice = 250;
            items.add(ord);
        }
        
        return items;
    }
    
    /**
* @name SetupTestData
* @description Inserts accounts, contacts, Products, PricebookEntries, Orders, and OrderItems.
**/
    public static void InsertTestData(Integer cnt){
        //ToDo: Ensure this method calls each of the construct methods
        //  and inserts the results for use as test data.
        CollaborationGroup groups = TestDataFactory.ConstructCollaborationGroup();
        insert groups;
        
        List<Product2>  products= TestDataFactory.ConstructProducts(cnt);
        System.debug('THBS ---- products' + products);
        insert products;
        
        List<PriceBookEntry> entries = TestDataFactory.ConstructPricebookEntries(products);
        insert entries;
        
        List<Account> accts = TestDataFactory.ConstructAccounts(cnt);
        insert accts;
        
        List<Contact> contacts = TestDataFactory.ConstructContacts(cnt,accts);
        insert contacts;
        
        List<Order> orders = TestDataFactory.ConstructOrders( cnt,  accts);
        insert orders;
        
        List<OrderItem> items = TestDataFactory.ConstructOrderItems(cnt, entries, orders);
        insert items;
        
    }
    
    public static void VerifyQuantityOrdered(Product2 originalProduct, Product2 updatedProduct, Integer qtyOrdered) {
        System.assertEquals((updatedProduct.Quantity_Ordered__c - originalProduct.Quantity_Ordered__c), qtyOrdered);
    }

    
}
 
@isTest (seeAllData=false)
private class Product2Tests {
    
    /**
* @name product2Extension_UnitTest
* @description UnitTest for product2Extension
**/
    @isTest private static void Product2Extension_UnitTest(){
        
        Test.startTest();
        
        PageReference pageRef = Page.Product2New;
        Test.setCurrentPage(pageRef);
        
        Product2 prod = new Product2(name='Test',isActive=true);
        ApexPages.StandardController stdcontroller = new ApexPages.StandardController(prod);
        
        Product2Extension ext = new Product2Extension(stdcontroller);
        System.assertEquals(Constants.DEFAULT_ROWS, ext.productsToInsert.size());
        
        ext.AddRows();
        System.assertEquals(Constants.DEFAULT_ROWS * 2, ext.productsToInsert.size());
        
        for (Integer i = 0; i <= 5; i++) {
            Product2Extension.ProductWrapper wrapper = ext.productsToInsert[i];
            Product2 p = new Product2();
            p.Name = 'Test Product ' + i;
            p.IsActive = true;
            p.Initial_Inventory__c = 20;
            p.Family = Constants.PRODUCT_FAMILY[0].getValue();
            wrapper.productRecord = p;
            
            PricebookEntry pbe = new PricebookEntry();
            pbe.IsActive = true;
            pbe.UnitPrice = 10;
            wrapper.pricebookEntryRecord = pbe;
        }
        
        ext.save();
        ext.GetFamilyOptions();
        ext.GetInventory();
        Test.stopTest();
        
        List<Product2> createdProducts = [SELECT Id FROM Product2];
        System.assertEquals(6, createdProducts.size());
    }
    
    @isTest private static void Product2Trigger_UnitTest(){
        
        Test.startTest();
        Product2 p = new Product2();
        p.Name = 'TestProduct';
        p.Family = 'Side';
        p.IsActive = true;
        p.Quantity_Ordered__c = 50;
        p.Initial_Inventory__c = 100;
        insert p;
        
        CollaborationGroup c = new CollaborationGroup();
        c.Name = 'TEST3' + Constants.INVENTORY_ANNOUNCEMENTS;
        c.Description = 'test';
        c.CollaborationType = 'Public';
        insert c;
        
        p.Quantity_Ordered__c=96;
        update p;
        Test.stopTest();
    }
}
 
@isTest (seeAllData=false)
private class OrderTests {
	@testSetup
    static void SetupTestData() {   
        TestDataFactory.InsertTestData(3);  
    }
    
    static testmethod void OrderUpdate_UnitTest() {
    	Order selectedOrder = [Select name,Status, Id from Order limit 1];
        Product2 oldProd = [Select Quantity_Ordered__c, Name, Id from Product2 limit 1];
        
        selectedOrder.Status = Constants.ACTIVATED_ORDER_STATUS;
        update selectedOrder;
        
        Product2 updatedProd = [Select Quantity_Ordered__c, Name, Id from Product2 limit 1];
        
        TestDataFactory.VerifyQuantityOrdered(oldProd,updatedProd,Constants.DEFAULT_ROWS);
    }
    
    static testmethod void OrderExtension_UnitTest() {
        PageReference reference = Page.OrderEdit;
        Test.setCurrentPage(reference);
        Order CurOrder = [Select Id,Status from Order limit 1];
        ApexPages.StandardController controller = new Apexpages.StandardController(CurOrder);
        OrderExtension extension = new OrderExtension(controller);
        extension.selectedFamily = 'Dessert';
        extension.SelectFamily();
        extension.OnFieldChange();
        extension.First();
        extension.Next();
        extension.Previous();
        extension.Last();
        extension.GetHasNext(); 
        extension.GetPageNumber();
        extension.GetHasPrevious();
        extension.GetTotalPages();
        extension.GetFamilyOptions();
        extension.Save();
        ChartHelper.GetInventory();
    } 
    

}

 
This code example: 
 
public class RESTGetHttpContentCallout {
    private static final String htmlBadgesClass = 'tds-tally__count tds-tally__count_success">';
    private static final String htmlPointsClass = 'tds-tally__count tds-tally__count_success">'; 
    private static final String htmlTrailsClass = 'tds-tally__count tds-tally__count_success">';
    private static final String htmlBadgesJson = '<div data-react-class="BadgesPanel" data-react-props="';
    private static final string JsonFinalChar = '">';
    private static integer modulos = 0, superbadges = 0, eventos = 0, projetos = 0;
    
    
    public static Map<String, String> getCalloutResponseContents(String url){
        HttpResponse res = new HttpResponse();
        try{
            Http h = new Http();
            HttpRequest req = new HttpRequest();
            req.setEndpoint(url);
            req.setMethod('GET'); 
            req.setHeader('Content-Type', 'application/json');
            System.debug('req' + req);
            res = h.send(req);
            System.debug('THBS ---- res' + res);
        }catch(Exception e){
            System.debug('An exception occurred: ' + e.getMessage());
        }
        String lBody = res.getBody(); 
       
        System.debug('THBS ---- res.getBody();' + res.getBody());
        String lContactBadges = getValue( htmlBadgesClass, lBody );
        String lContactPoints = getValue( htmlPointsClass, lBody );
        String lContactTrails = getValue( htmlTrailsClass, lBody );
        String lJsonBadges = getJsonValue( htmlBadgesJson, JsonFinalChar, lBody);
        system.debug('--->> ' + lContactBadges);
        system.debug('THBS ---- lContactPoints' + lContactPoints);
        System.debug('THBS ---- lContactTrails' + lContactTrails);
        Map<String,String> lMapToReturn = new Map<String,String>();
        lMapToReturn.put('Badges', lContactBadges); 
        lMapToReturn.put('Pontos', lContactPoints);
        lMapToReturn.put('Trails', lContactTrails);
        lMapToReturn.put('Modulos', string.valueOf(modulos));
        lMapToReturn.put('Superbadges', string.valueOf(superbadges));
        lMapToReturn.put('Projetos', string.valueOf(projetos));
        lMapToReturn.put('Eventos', string.valueOf(eventos));
        system.debug('THBS ---- lMapToReturn' + JSON.serialize(lMapToReturn));
        return lMapToReturn;
    }
    
    private static String getJsonValue(string aClass, string finalChar, string aBody){
        Integer lInit = getInitialLocationByAttributeClass(aClass, aBody);
        Integer lEnd = getFinalLocationByInitialLocationAndFinalChar(lInit, finalChar, aBody);
        return getAttributeValues(lInit, lEnd, aBody);
    }  
    
    private static String getValue( String aClass, String aBody )
    {
        Integer lInit = getInitialLocationByAttributeClass(aClass, aBody);
        Integer lEnd = getFinalLocationByInitialLocation(lInit, aBody);
        return getAttributeValues(lInit, lEnd, aBody);
    }
    
    private static Integer getInitialLocationByAttributeClass(String lClassName, String lBody){
        System.debug('THBS ---- lClassName' + lClassName);
        System.debug('THBS ---- lClassName length' + lClassName.length());
        System.debug('THBS ---- lBody.indexOf(lClassName)' + lBody.indexOf(lClassName));
        return lBody.indexOf(lClassName) + lClassName.length();   
    }
    
    private static Integer getFinalLocationByInitialLocation(Integer lInitialLocation, String lBody){
        return lBody.indexOf('</html>',lInitialLocation);      
    }
    private static Integer getFinalLocationByInitialLocationAndFinalChar(Integer lInitialLocation, string finalChar ,String lBody){
        return lBody.indexOf(finalChar,lInitialLocation);      
    }
    
    private static String getAttributeValues(Integer lAttrInitialLocation, Integer lAttrFinalLocation, String lBody){
        System.debug('THBS ---- lAttrFinalLocation' + lAttrFinalLocation);
        System.debug('THBS ---- lBody' + lBody);
        System.debug('THBS ---- lAttrInitialLocation' + lAttrInitialLocation);
         
        return lBody.substring(lAttrInitialLocation,lAttrFinalLocation).replace('\n','');  
    }
    
}

 
The Endpoint return only html. I want to restore points, badges and trails in Trailhead, but after change web site trailhead, it is no longer possible.

public class RESTGetHttpContentCallout {
    private static final String htmlBadgesClass = 'tds-tally__count tds-tally__count_success">';
    private static final String htmlPointsClass = 'tds-tally__count tds-tally__count_success">'; 
    private static final String htmlTrailsClass = 'tds-tally__count tds-tally__count_success">';
    private static final String htmlBadgesJson = '<div data-react-class="BadgesPanel" data-react-props="';
    private static final string JsonFinalChar = '">';
    private static integer modulos = 0, superbadges = 0, eventos = 0, projetos = 0;


    public static Map<String, String> getCalloutResponseContents(String url){
        HttpResponse res = new HttpResponse();
        try{
            Http h = new Http();
            HttpRequest req = new HttpRequest();
            req.setEndpoint('https://trailblazer.me/id/+ profilenameorId);
            req.setMethod('GET'); 
            req.setHeader('Content-Type', 'application/json');
            System.debug('req' + req);
            res = h.send(req);
            System.debug('THBS ---- res' + res);
        }catch(Exception e){
            System.debug('An exception occurred: ' + e.getMessage());
        }
        String lBody = res.getBody(); 

        System.debug('THBS ---- res.getBody();' + res.getBody());
        String lContactBadges = getValue( htmlBadgesClass, lBody );
        String lContactPoints = getValue( htmlPointsClass, lBody );
        String lContactTrails = getValue( htmlTrailsClass, lBody );
        String lJsonBadges = getJsonValue( htmlBadgesJson, JsonFinalChar, lBody);
        system.debug('--->> ' + lContactBadges);
        system.debug('THBS ---- lContactPoints' + lContactPoints);
        System.debug('THBS ---- lContactTrails' + lContactTrails);
        Map<String,String> lMapToReturn = new Map<String,String>();
        lMapToReturn.put('Badges', lContactBadges); 
        lMapToReturn.put('Pontos', lContactPoints);
        lMapToReturn.put('Trails', lContactTrails);
        lMapToReturn.put('Modulos', string.valueOf(modulos));
        lMapToReturn.put('Superbadges', string.valueOf(superbadges));
        lMapToReturn.put('Projetos', string.valueOf(projetos));
        lMapToReturn.put('Eventos', string.valueOf(eventos));
        system.debug('THBS ---- lMapToReturn' + JSON.serialize(lMapToReturn));
        return lMapToReturn;
    }

    private static String getJsonValue(string aClass, string finalChar, string aBody){
        Integer lInit = getInitialLocationByAttributeClass(aClass, aBody);
        Integer lEnd = getFinalLocationByInitialLocationAndFinalChar(lInit, finalChar, aBody);
        return getAttributeValues(lInit, lEnd, aBody);
    }  

    private static String getValue( String aClass, String aBody )
    {
        Integer lInit = getInitialLocationByAttributeClass(aClass, aBody);
        Integer lEnd = getFinalLocationByInitialLocation(lInit, aBody);
        return getAttributeValues(lInit, lEnd, aBody);
    }

    private static Integer getInitialLocationByAttributeClass(String lClassName, String lBody){
        System.debug('THBS ---- lClassName' + lClassName);
        System.debug('THBS ---- lClassName length' + lClassName.length());
        System.debug('THBS ---- lBody.indexOf(lClassName)' + lBody.indexOf(lClassName));
        return lBody.indexOf(lClassName) + lClassName.length();   
    }

    private static Integer getFinalLocationByInitialLocation(Integer lInitialLocation, String lBody){
        return lBody.indexOf('</html>',lInitialLocation);      
    }
    private static Integer getFinalLocationByInitialLocationAndFinalChar(Integer lInitialLocation, string finalChar ,String lBody){
        return lBody.indexOf(finalChar,lInitialLocation);      
    }

    private static String getAttributeValues(Integer lAttrInitialLocation, Integer lAttrFinalLocation, String lBody){
        System.debug('THBS ---- lAttrFinalLocation' + lAttrFinalLocation);
        System.debug('THBS ---- lBody' + lBody);
        System.debug('THBS ---- lAttrInitialLocation' + lAttrInitialLocation);

        return lBody.substring(lAttrInitialLocation,lAttrFinalLocation).replace('\n','');  
    }

}
global class BatchGetTrailheadOfContacts implements Database.Batchable<sObject>, Database.AllowsCallouts {

   global Database.QueryLocator start( Database.BatchableContext bc ) {
      return Database.getQueryLocator('SELECT Id, Link_para_o_perfil_no_trailhead__c,Total_Pontos__c '
                                    + 'FROM Contact WHERE Ativo__c = true '
                                    + 'AND Link_para_o_perfil_no_trailhead__c != null');
    }    

   global void execute( Database.BatchableContext bc, List<Contact> scope ){
       Contact lcontact_Total_Pontos = new contact();
       decimal total_pontos = 0;

       for ( Contact lContact : scope ) {
            Map<String,String> lMapToGetStats = RESTGetHttpContentCallout.getCalloutResponseContents(lContact.Link_para_o_perfil_no_trailhead__c);
            if ( lMapToGetStats == null ) continue;

            System.debug('lMapToGetStats' + lMapToGetStats);
            System.debug('lMapToGetStats Badges' + lMapToGetStats.get('Badges'));
            String Pontos = lMapToGetStats.get('Pontos').replace('.', '');
            System.debug('lMapToGetStats' + lMapToGetStats.get('Pontos'));
            System.debug('Points' + Pontos);
            lContact.Pontos_no_trailhead__c = Pontos.isNumeric() ?  integer.valueOf(Pontos) : 0;
            lContact.Badges_no_trailhead__c = lMapToGetStats.get('Badges').isNumeric() ?  integer.valueOf(lMapToGetStats.get('Badges')) : 0;
            lContact.Trilhas_concluidas__c  = lMapToGetStats.get('Trails').isNumeric() ?  integer.valueOf(lMapToGetStats.get('Trails')) : 0;
            total_pontos +=  lContact.Pontos_no_trailhead__c;
          system.debug('pontos de cada talento: '+ lContact.Pontos_no_trailhead__c);
         // system.debug( 'total de pontos:'+ total_pontos);
      }
      lcontact_Total_Pontos.Total_Pontos__c =  total_pontos;
        system.debug( 'total de pontos:'+  lcontact_Total_Pontos.Total_Pontos__c);
      update scope;
   }

  global void finish( Database.BatchableContext bc ) {}

    global void execute(SchedulableContext sc) {
 BatchGetTrailheadOfContacts lbatch = new BatchGetTrailheadOfContacts();
    Database.executeBatch(lbatch); 
  }
}

 
<div aura:id="error-toast-container" class="slds wr-toast-container wr-toast-container-format slds-hide" >
		<div aura:id="error-toast" class="slds-notify slds-notify_toast wr-toast-format" role="alert">
                <span aura:id="iconToast" class="slds-hide slds-icon_container slds-icon-utility-error slds-m-right_small slds-no-flex slds-align-top">
                    <lightning:icon iconName="utility:warning"/>
                </span>
			<div class="slds-notify__content">
				<h2 class="slds-text-heading_small">
					<lightning:formattedText value='{!v.errorMessage}'/>  
					<lightning:button aura:id="addLine" class="slds-hide wr-destructive-link-format" variant="" onclick="{!c.onReadMore}">{!$Label.c.ReadMore}</lightning:button> 
				</h2> 
			</div>
			<lightning:buttonIcon variant="bare" class="slds-notify__close slds-button_icon-inverse" title="Close" iconName="utility:close" onclick="{!c.closeToast}" size="large">
			</lightning:buttonIcon>
		</div>
	</div>

 
I wanted to figure out if there is or if there is any plan to open challenges data via an api so that we can reward employees for completing trialhead data.