• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Using Liquid (or anything else) Is there a way to access the user name or ID of the person that submitted a webapps?

New Here ,
Jun 02, 2015 Jun 02, 2015

Copy link to clipboard

Copied

Users do not input their name when submitting one of my web apps, when a site admin creates a web app they will assign it to a customer (via "Submitted by" under "More Options" in the Add Item view).  I need to access to this customer user name that submitted the web app and I would like to collect that information via liquid.  Any help would be greatly appreciated.

TOPICS
Web apps

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 02, 2015 Jun 02, 2015

Copy link to clipboard

Copied

Hi there,

Since you can only submit a web app item on the front end if you are logged in.. thus you will have an email/name in the CRM with username and password.

To select an owner you need to select a CRM entry that has at least a name and email.

So there are no cases where users do not have their name here.

BC has never had an owner output on these or associated output of ID etc and Liquid does not either.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 02, 2015 Jun 02, 2015

Copy link to clipboard

Copied

You are correct that they cannot be anonymous.  What I am asking is how do extract their user name from the web app collection? 

As an example if userName where to give me access to the submitters name I might do this:

{module_webapps id="12345" filter="all" template="" collection="formdata"}

{% for data in formdata.items %}

{{data.userName}}

{% endfor %}

I need to be able pull from any given submission the user name who submitted it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 02, 2015 Jun 02, 2015

Copy link to clipboard

Copied

or where/how can I find an association between a customer and a submitted web app?  Is there an item within a given customer record that I can access that will give a web_app ID and collection ID that I can use to find their submission(s)?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 02, 2015 Jun 02, 2015

Copy link to clipboard

Copied

Like I said, not on the front end at this time.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 03, 2015 Jun 03, 2015

Copy link to clipboard

Copied

Liam what you are saying is that there is is no way to look at the currently logged in customer's record to see what web apps they have  created via any method and there is no way to loop through all the items of a collection to see who created.

I've tested the latter and it is the case, but not the former.  I will and report back.  There is an obvious work around that I'll also post should that be the case and maybe there is someone out there who can offer a better solution.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 03, 2015 Jun 03, 2015

Copy link to clipboard

Copied

There is no way on a web app item to know the owner.

Which is what you asked and I answered on.

When logged there of course is a way to know the items they have created, there always has been..
Developer reference

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 03, 2015 Jun 03, 2015

Copy link to clipboard

Copied

Other than making the web app editable only by the submitter, which is not the case for the web app I am referring to, I don't see how you can know which web app they created.  What I am looking for is a way to identify the creator of individual web app items and or identify which items within a collection were created by the currently logged in user.
 

The Dev reference does not appear to contain a tag that does this unless I am missing something.


One use case is:

A Logged in user looks at a list of web apps.  Within that list is a highlighted group that were created by them.


To highlight that group I would need to know which were created by that user.



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 04, 2015 Jun 04, 2015

Copy link to clipboard

Copied

Liam,
One more question I meant to ask earlier.

You said: "When logged there of course is a way to know the items they have created, there always has been.."  I would I know?  Where would I find this information? It doesn't appear to be in the globals.user object am I not lookin gin the right areas?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 03, 2015 Jun 03, 2015

Copy link to clipboard

Copied

We have managed this solution on www.inspirezone.co website. Every user has it's own page that shows it's submitted web app items.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 03, 2015 Jun 03, 2015

Copy link to clipboard

Copied

AT80  I am going to capture the logged in user information in a variable (1), use the information to populate custom fields(2) in the web app input form and to filter the display of list items (3).  Additionally, I can now reference the user without issue 

1. Capture and store the user information

{% assign userName = globals.user.username %}

{% assign fName = globals.user.firstname %}

{% assign lName = globals.user.lastname %}

{% assign email = globals.user.email %}

2. use it to populate a web app field

<input type="text" value="{{ userName }}" maxlength="4000" name="CAT_Custom_17" id="CAT_Custom_17" class="cat_textbox hidden" />

3. filter based upon

{% if item.cat_custom_17 == {{userName}} %}
Do something special
{% else %}
  do something not so special
{% endif %}

BTW.  www.inspirezone.co is a very nice site -- good job!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 03, 2015 Jun 03, 2015

Copy link to clipboard

Copied

You do not need to assign globals like that.

<input type="text" value="{{globals.user.username}}" maxlength="4000" name="CAT_Custom_17" id="CAT_Custom_17" class="cat_textbox hidden" />

And if your in liquid tags you do not need to do more liquid tags..

{% if item.cat_custom_17 == globals.user.username -%}

{% else -%}

do something not so special

{% endif -%}

If you are running a collection it has a limit of 500 items only, if you have an if on an item and you render a module on pagination, currently you will see some funky (not good) stuff so keep that in mind.
Your code as a note would only show if that person is logged in and because of the above and that you already have a module to output a list of submitted items I take it your only using it on the detail view when they go through?

If that is the case then, when they are on the detail view themselves, they own the webapp so you can know it is theirs, the url paramaters to edit for example passed will switch to the edit layout etc.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 03, 2015 Jun 03, 2015

Copy link to clipboard

Copied

1. Yes you can just use: {{globals.user.email}}, {{globals.user.firstname}}, {{globals.user.lastname}}

The way we have done this solutions is:

1. Create a web app: User profile (This way anyone can see a users profile)

    Fields: Email, Fullname, etc...

2. Create another web app for shots.

    Fields: Fullname

3. In the user profile detailed page:

     Using liquid, we used for loop to get all the shots and shown only the ones are equal to the user fullname.

    

     {%for item in userShots.items %}

         {% if {{item.['author name']}} == {{name}} %}

              {module_webapps id="29546" filter="item" itemId="{{item.itemid}}"}

         {% endif %}

    {%endfor%}

and Thanks about the site.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 03, 2015 Jun 03, 2015

Copy link to clipboard

Copied

I do not think you understand what I been saying

If you are not logged in, there are no details so those globals will of course not render any output. They also will not represent a web app owner when someone else views the site etc.

What you have said there will work, you could skip the user profile web app since there is module_data and CRMv3 api but that is ok. You need to consider though that if you have 500 items the above will not work for anything over that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 03, 2015 Jun 03, 2015

Copy link to clipboard

Copied

Oh, didn't know there was a limit of 500 items. Thanks for telling.

Liam, do you know how to show rating value inside a list view.

Rating value from 0 to 5 is showing inside the detailed view but not in the list view.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 04, 2015 Jun 04, 2015

Copy link to clipboard

Copied

Not without javascript ajax fetching. I not actually checked or had the chance to check if the liquid object shows that But I am betting no.
Because you actually use a module to fetch the rating, not an actual items tag as such so it works a bit different from actual item data. Same as to comments themselves.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 04, 2015 Jun 04, 2015

Copy link to clipboard

Copied

Liam,

Some quick clarification:

- My users will always be logged in.

- I intended to assign the user values, because I'll be reusing them, at times, across multiple items within a page and felt it to be slightly more efficient -- i'll revert to using globals..

- I will not use pagination.  Where lists are long I give the user controls and filters to limit the display via javascript (jquery). 

- I didn't know that there was a 500 item limit -- THANKS!

- I'm using liquid for all web app data display (assorted lists, some fancy charts, and two sets of detail views) the layout facility built in to the module is too limiting and I don't want to have many lines of js to have it properly formatted when it can all be done server side.   Is this not good?

A couple questions:

- You said:" ...the url paramaters to edit for example passed will switch to the edit layout etc."  I am having to construct the edit link form the  {{item.url}} is there a more direct way?

- In response to AT80 you said:"...you could skip the user profile web app since there is module_data and CRMv3 api..."  Can you expand on this. What is module_data and how does it apply to customers/web apps in the above example.  CRMv3 seems to not apply to web apps are you recommending for another reason or does it have some utility that I am missing?

Thank you AT80 and Liam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 04, 2015 Jun 04, 2015

Copy link to clipboard

Copied

- My users will always be logged in.
If you intend them to see their own things, access their information and do things like fetch username etc with liquid - Yes, You can not submit items etc if you are not logged in.


- I intended to assign the user values, because I'll be reusing them, at times, across multiple items within a page and felt it to be slightly more efficient -- i'll revert to using globals.

That is fine, you just did not mention that before but its not more efficient with liquid, it is just your preference.


- I will not use pagination. Where lists are long I give the user controls and filters to limit the display via javascript (jquery).
if your doing things as collections you will not have pagination and currently you can not replicate pagination with modules (BC has not sorted this yet)

- In terms of the edit url - Look at what the link renders - it is only ?a=edit or something in the url.

- Developer reference - module_data

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 15, 2015 Jun 15, 2015

Copy link to clipboard

Copied

LATEST

Liam is right, you can also install the BC API Discovery. It will help you with your query when using module_data. This is  way you can use module_data with webapp. It has worked for me.

{module_data resource="customers" version="v3" fields="username,email1" where="\{'email1.value':\{'$contains':'i{{this.globals.user.email}}'\}\}" skip="0" limit="500" collection="myData" template=""}   // Limit the CRM data dump to only the logged in user

{module_webapps id="usersubmittedwebapp_id" filter="all" collection="collectionname" template=""} // Call the user submitted webapp in question

{% for item in collectionname.items -%} // loop the webapp

{% if globals.user.email == item.email -%}   // Use liquid logic to find any customer field stored in the webapp by the logged in user.

do something.... (Like displays data items submitted by the logged in user)

{%endif -%}

{%endfor -%}

I hope it helps

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines