• Ritik
  • NEWBIE
  • 55 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 1
    Likes Given
  • 29
    Questions
  • 32
    Replies

I'm trying to create a consistent look and feel for Lightning web components by using a common CSS module. For this, I have followed the solutions given in https://releasenotes.docs.salesforce.com/en-us/summer20/release-notes/rn_lwc_css_share.htm and https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.create_components_css_share.

Now, if I'm creating css file in the below structure

cssLibrary ├──cssLibrary.css └──cssLibrary.js-meta.xml

then, when I'm calling this cssLibrary in my main component c:compositionBasics as @import 'c/cssLibrary' I'm getting the error as "force-app\main\default\lwc\compositionBasics\compositionBasics.js No MODULE named markup://c:cssLibrary found : [markup://c:compositionBasics]"


while, if I'm creating the files as (added JS and HTML files as well, just like any other lwc component)
cssLibrary ├──cssLibrary.css └──cssLibrary.js-meta.xml ├──cssLibrary.js └──cssLibrary.html

then I'm able to save the compositionBasics component (NO errors) but my CSS is not getting reflected.

Note: detailed code can be found in https://github.com/trailheadapps/lwc-recipes/tree/master/force-app/main/default/lwc/compositionBasics (My folder structure of compositionBasics is also exactly same)

Please help! Do let me know if I'm missing anything in here. Also let me know if for nesting a css @import 'c/cssLibrary'; is not a correct way.

Best,
Ritik

Is it possible to display internal salesforce article on public site?

If yes then how?
Even I have tried to make a visual force page and have tried to display data thru it but it is not getting displayed on site(while internally everything is visible on that page but not site) . So if anyone knows how to give access to profile of site then please let me know.
Any other solutions are also welcome.
Hi,

I have already built site login page and some pages after that with Customer Portal enabled. 
Now I have a requirement wherein if a user is already loggedin so he should be redirected to page2 else to page 1.
With little digging I have found that by checking (UserInfo.getUserType() != 'guest') we can check if the user is loggedin or not.

But my main concern is that: If I am getting redirected from some other website/webpage to my SFDC site and
        if the user
             - is already logged in then he should get redirect to the page2.i.e. if the same browser is used for redirecting to SDFC site so with the same session Id he should be logged in into my portal.
             - else to page 1 where he has to fill some information ........... and do some tasks

Please let me know if some further information is required.

Best,
Ritik 
              
Hello All,

I am not able to create new community (from All Communities --> New Communities). The error I am getting is "An internal server error has occurred". Error ID: 310890904-203823 (-1617309786)

 Can anybody help in creating a new one or else let me know the possible solution.

Best,
Ritik
Hello,


I am trying get the content of the attachment using APEX.
For this I have used -
    string myEncodedString = EncodingUtil.base64Encode(mailAttachment.Body);
        system.debug('myEncodedString +++++++ ' + myEncodedString);
        
        string attBody = EncodingUtil.base64Decode(myEncodedString).toString();

With this I am able get data for csv and .txt(UTF-8 enconded) file but I am not abl read the contents of .docx, .xlsx, .pdf etc
The error I get is 'BLOB is not a valid UTF-8 string'.
After a bit of research I found that, though formats like .docx are encoded in UTF-8 but they are archieved formats (similar to zip).

So can anybody help me to get the content of these formats.

Help would be appriciated.

Best,
Ritik
HI 

I have date in 2016-02-04T22:21:32.169Z format.How to convert it to Apex DateTime?

Ed
Hello,
I have a requirement wherein I have to send mail to list of users with appropriate email template. 
But, the end-user who will send mail (on click of a button) should see the template on a page and should also be able to edit it (if required). 
i.e the email template should be displayed in an input text.

For this I have created a vf page with a class. 

Here I am able to query all email tempaltes in the org.
I have used below quries
Query1:
SELECT Body, BrandTemplateId, Description, DeveloperName, FolderId, Folder.DeveloperName , HtmlValue, 
        Id, IsActive, Markup, Name, Subject, TemplateStyle, TemplateType, 
FROM EmailTemplate

AND

Query2:
select id, name, value from BrandTemplate


But still I am not able to display the template as is in vf page.


Please help.
Do let me know if any futher clarification is required.


Thanks,
Ritik
Hello,

How can we develop blog kind of thing in my vf page, wherein, if the page is hosted on force.com site then the end user can write reviews, give ratings, and then retweet on some comments.


Thanks and Regards,
Ritik
Hi,

I have a code wherein we have used JQuery to for autocomplete (jQuery.ui.autocomplete.prototype._renderItem).

Here problem is that if first "MyFirstFieldAutocomplete" gets invokes then third "MyThirdFieldAutocomplete" doesn't gets invoked.
While auto populate functionality works fine if value in MyThirdFieldAutocomplete is filled first.
(One more problem is that even no console logs/alerts gets generated(so that I can debug) if we fill MyFirstFieldAutocomplete first.)


**************CODE******************************

 jQuery(document).ready(function(){
    jQuery.ui.autocomplete.prototype._renderItem = function( ul, item) {
          var re = new RegExp(this.term, "i") ;
          var t = item.label.replace(re,"<span style='font-weight:bold;color:Blue;'>" + this.term + "</span>");
          return jQuery( "<li></li>" )
              .data( "item.autocomplete", item )
              .append( "<a style='cursor: pointer; background-color:white;'>" + t + "</a>" )
              .appendTo( ul );
    };
    
    jQuery('.MyFirstFieldAutocomplete, .MySecondFieldAutocomplete, .MyThirdFieldAutocomplete, ').each(function(){
        var thisInput = this;
        
        console.log('this' + this);
        jQuery(this).autocomplete({
            minLength: 2,            
            source: function(request, response) {  
                queryTerm = request.term;
                console.log('queryTerm ' + queryTerm );
                
                var filterValue = '';
                var searchObject = '';
                var fieldList = '';
                var filterField = '';
                
                if(jQuery(thisInput).hasClass('MyFirstFieldAutocomplete')){
                    filterValue = 'First RecordType';
                    searchObject = 'Account';
                    fieldList = 'BillingCountry';
                    filterField = 'recordtype.name';
                }else{
                    if(jQuery(thisInput).hasClass('MySecondFieldAutocomplete')){
                        filterValue = 'SecondFilter';
                    }
                    searchObject = 'CustomObject__c';
                    filterField = 'customField__c';                
                }
                
                if(jQuery(thisInput).hasClass('MyThirdFieldAutocomplete')){
                    filterValue = 'Third RecordType';
                    searchObject = 'Account';
                    fieldList = 'BillingCountry';
                    filterField = 'recordtype.name';
                    alert('High School');
                    console.log(filterValue, searchObject, fieldList, filterField);
                    console.log('Test2');
                    console.log('queryTerm inside MyThirdField' + queryTerm );
                }
                
                console.log(filterValue, searchObject, fieldList, filterField);
                
                myClassController.getAutoCompleteList(filterValue, request.term, searchObject, fieldList, filterField, 
                    function(result, event){
                    if(event.type == 'exception'){
                        alert(event.message);
                    }else{
                        sObjects = result;
                        response(sObjects);
                    }
                });
            },
            select: function(value, data){
                if (typeof data == "undefined") {
                    this.value= value;
                }else{
                    lookupPick2('formId',this.id+'_lkid',this.id,data.item.recordId,htmlDecode(data.item.name),false);
                }
                return false;
            }
        });             
    });
});


<td>
   <apex:inputField value="{!lstCustomObjNew.customFieldLookup__c}" id="thirdId" styleClass="MyThirdFieldAutocomplete"/>
</td>


Any help would be appriciated.


Regards,
Ritik
Hi,

Is there any possible method by which I can format the UI of error message in a trigger?

Scenerio:
I have to display the error when a person clicks "Save" (standard button) on a Custom Object's standard edit page layout.
For this I have written a trigger (trigger.New.addError(......)).
Here, I have to display a table (which will show all the values coming from a list.)
If not possible, I have to display values of atleast one field in different rows.
For this I have written

errorMsg = 'Following possible duplicates are present: ';
for(integer i=0 ; i < myListVar.size(); i++){
          errorMsg +=  myListVar[i].name + '\n';
}
Trigger.new[0].addError(errorMsg);


But it is not working. The whole text is coming in one line. (Although in debug log it is coming in different lines.)
Instead of \n I have also tried \r\n.

So, please tell me a method by which I can display the error mesaage in a better way.
If possible, I also want a hyperlink in names in error  message.

 
Thanks,
Ritik
Hi,

How can I check a particular field's dependencyin the org.

To ensure dependency I have tried to delete the field but it is not the foolproof solution as some dependecies, like reports etc., are not getting covered in that.

SO what is method by which I can garuntee that a metadata (especially a field) is used /have dependency in all other metadata?

Eg: A field XYZ is used in a class, VF page, validation rule, report etc.
So I need the list wherever this XYZ field is used.


Hope my query is clear, but do let me know if any further information is required.


Thanks,
Ritik


 
Hi,

I have a field of data type Long Text Area wherein I have some data in below mentioned format. Here I have to mask some text (not everything) from this data (Please refer the example below ). Can anybody help me in achieving this or atleast tell me the appropriate approach for this.


Example:
Sample Input (Data in in the LONG TEXT AREA field):

Name     : ABCDEF
Age        : 20 Years
Email    : testEmail@test.com
Body    : This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text.
          This is a sample text. This is a sample text. This is a sample text. This is a sample text.
Some Other Data: This is a sample text. This is a sample text. This is a sample text. This is a sample text.          
DOB        : 01-01-1905
Some Other Data1: This is a sample text. This is a sample text. This is a sample text. This is a sample text.          
Some Other Data2: This is a sample text. This is a sample text. This is a sample text. This is a sample text.          
Some Other Data3: This is a sample text. This is a sample text. This is a sample text. This is a sample text.          
Some Other Data4: This is a sample text. This is a sample text. This is a sample text. This is a sample text.


Sample Output (which is required)
Name     : XXXXXX
Age        : XX Years
Email    : XXXXXXXXX@XXXX.XX
Body    : This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text.
          This is a sample text. This is a sample text. This is a sample text. This is a sample text.
Some Other Data: This is a sample text. This is a sample text. This is a sample text. This is a sample text.          
DOB        : XX-XX-XXXX
Some Other Data1: This is a sample text. This is a sample text. This is a sample text. This is a sample text.          
Some Other Data2: This is a sample text. This is a sample text. This is a sample text. This is a sample text.          
Some Other Data3: This is a sample text. This is a sample text. This is a sample text. This is a sample text.          
Some Other Data4: This is a sample text. This is a sample text. This is a sample text. This is a sample text.      



Here name, age, dob etc. are masked.

Any help would be great.



Regards,
Ritik
Hi,

Has any body done any integration with Sunstone analytics.
If yes please let me know.
Let me know if there are any APIs available or is there any tool or anything else available to integrate that with salesforce.


Regards,
Ritik
Hi,

I need to Integrate youtube search engine in my visualforce page. So that whenener the user searches the video in search bar, he should get a list of videos present in youtube (same as in youtube website). After that when he clicks one of the video of the list, he should be redirected to that video in youtube.

I have tried an example given in https://developers.google.com/youtube/v3/code_samples/javascript but I'm not able to make it workable.
Any help would be highly appriciated.
Please treat it as urgent.

Thanks in advance! :)

Regards,
R_Shri