I'm looking to change an internal Roomle parameter from externally from a webpage. I have 3 icon menus within roomle, the webpage that the Roomle is hosted on has users logins, so depending on who has logged in I want to hide certain Roomle Icons Menus, for example if Person1 is logged in I want to set the internal Roomle parameter of allowSplinta==true, allowCB==true, allowTB==true but if Person2 is logged in I want to set allowSplinta==false, allowCB==true, allowTB==false, so Person2 will only see 1 icon menu.
I see from the documentation this seems to be possible but unsure how to implement it, there is a section on the roomle site "Parameter Implementation outside of the configurator iFrame"
As you mentioned there is a section in the docs which explains this.
Basically you have to make sure the configuration is loaded (await loadObject) and then get all the parameters using your configurator instance:
const params = await configurator.extended.getParametersOfRootComponent();
If you know which parameter you want you can search it in the params array:
const viewParam = params.find(({key}) => key === 'door');
All valid values for this parameter are then stored in validValues (viewParam.validValues).
You can then use setParameterOfRootComponent to set the desired value:
configurator.extended.setParameterOfRootComponent(viewParam, value)
I created a CodeSandbox where you can take a look at the full example.
Related
I have an object with many record types, and I need to populate some fields on it whenever it is created.
For example, I have an object called "CustomObj" with a field called "CustomF" with these 2 Record Types "RecType1" and "RecType2".
On the creation of a new "CustomObj" I need to populate the field the "CustomF" by "Hello" when the record type is "RecType1"
and by "Bye" when the record type is "RecType2"
Can I do that using the URL Hacking or I have to create 1 visualforce page to select the record type then redirect to the standard page with the values to populate this field or there is another approach?
What is the best practice?
How can I know the RecordType selected from the url itself ?
Thank you.
You can do this by an Workflow Rule. Go to Setup->Create->Workflow & Approvals. Than u can choose your object on which u want to set up the workflows. Most of the part should be straightforward since all the steps are well documented.
So one rule would be like:
If Record Type == RecType1 than fill in Field XY with value ABC
I see.
This is also possible. Go to the object and than your field you want to fill in the value. Click on edit and use the formula editor.
You can use a rule like
IF( $RecordType.DeveloperName = 'RecType1', 'Value for this', '')
for the default value
Salesforce does not provide an option to override "continue" button on record type selection page. but you can override "new" button. So you can do the following
Override "New" button to move to a record type selection page, which
will be a custom vf page (use radio buttons, description etc.).
The submit button (u can name as "Continue", just to imitate) should redirect to the standard page of data entry. But the
URL will be custom made.
You can refer to this Blog (Saurabh's Salesforce Blog) - http://writeforce.blogspot.in/2012/12/prepopulating-fields-using-url-hacking.html - for the idea of how the URL hacking can be done as per your need. Here you need to identify the field id and use them in the URL to provide a value to be prepopulated.
I'm creating a MVC application with a CRUD. In the list view I have the PagedList helper. I set the pageSize variable in the code: pageSize= 5, so the list only show 5 files and allow go to the previous and next pages.
In the other side, I want to create an option called "Parameters" where the user can define yourself the "pageSize" value.
I'm confused about how to do it.
Thanks in advance.
Consider using a Profile provider
http://wiki.asp.net/page.aspx/1327/profile-provider-in-aspnet-mvc/
Or create a bespoke UserSettings table to store the setting yourself.
You can write pagesize that user choose in session variable and read it from it when you need:
To write to session you should call:
Session["pagesize"]=pagesize;
To read from session you can use:
var pagesize = (int)Session["pagesize"];
You should check that this value is in session before cast to avoid null reference exception.
Session variable can be used when you want keep it only during working period of user. If you want save it for long period, you should save it into database or in file.
If you are using Sql Sever, then do a simple table
Create Table UserProfile (
UserId Int Not null,
ProfileName Varchar(50) Not null
Value Varchar(50) Not Null
foreign key (UserId) references [UsersTable] (UserId)
)
You can save and retrieve PageSize or any other profile from this table.
What's common among modern web applications is a page size <select /> list:
What you want to do next is remember the user's choice in a cookie. The user experience (UX) is much better than the profile approach for 2 reasons:
both registered and anonymous users can select a page size
it is not necessary to navigate to a setting or profile page to select the page size
There are scenarios that call for a profile page but definitely not this one.
I have a page that displays a list with a of elements with a large number of elements, each of which has a boolean property, representing an Enabled and a Disabled state.
I need to provide the user with a link for each list item, and the link text must show the opposite status (so if the item is enabled, the link text must display 'Disable').
When the user clicks the link for a Disabled, the corresponding link text for the item must change to 'Enable' (and vice versa).
I would like to NOT reload the entire list for each click, just the text of the ActionLink itself, so my question is:
Is it possible to update just an ActionLink itself when the user clicks the link, or do I have do handle this using custom javascript?
As far as I remember, you can add HTML attributes to the "a" tag by newing up an anonymous class as the last param on most overloads.
Off the top of my head this can be written like the following:
Html.ActionLink("Name", "Action", "Controller", new { #class = 'updateId' });
(You may be able to do this with an ID which would be preferable over a class - if not just use a unique class name to avoid updating multiple items.)
Then you can use javascript to access the class "updateId" and change the inner html.
In the case of jQuery:
$("a.updateId").html("NewName");
This can be done with a custom user control contained within the element to update. A writeup of the solution can be found here. No custom client-side scripting is necessary.
In the Wicket Application class I have mounted a page at the location /about
mountBookmarkablePage("about", AboutPage.class);
I verify that the about page is available at /about. Then in the page which needs a link to the about page, I use the Wicket Link class:
add(new Link("link") {
#Override
public void onClick() {
setResponsePage(AboutPage.class);
}
};
)
The links work as expected but the target URL diplayed in the browser status bar when the mouse is over the link looks like
http://localhost:8080/?wicket:interface=:0:linkpage:repeating:1:link::ILinkListener::
A workaround which I have found is to use ExternalLink
new ExternalLink("link", "/about", "about");
This changes the target URL to
http://localhost:8080/about
which is displayed in the browser status bar when the mouse is over the link.
Is there a way to use the mounted URL as the target link with Wicket Link class, or is there a way to get the mount location for a class, so that I can use it to build the link url for AboutPage.class (instead of hard coding it in the ExternalLink constructor)?
For this purpose you should use BookmarkablePageLink (as you're saying you're doing), to set the link label (or any other content for that matter) just call .add(Component... c) since BookmarkablePageLink is actually a MarkupContainer.
So, to create a link to AboutPage.class you need to do this:
BookmarkablePageLink aboutLink = new BookmarkablePageLink("link", AboutPage.class);
aboutLink.add(new Label("linkText", "Go to About page"));
add(aboutLink);
and the matching markup
<a wicket:id="link"><span wicket:id="linkText">Link text goes here</span></a>
Yeppers, it's slightly more verbose but also very easily extensible. If you want to, you can create your own convenience subclass of BookmarkablePageLink called BookmarkableTextLink and have a
new BookmarkableTextLink(String id, Class<Page> pageClass, String linkText);
constructor for it.
Found a solution: the BookmarkablePageLink class
add(new BookmarkablePageLink("link", AboutPage.class));
This solution only has a small problem: the link label can not be set, maybe this can be done by assigning a model.
Our web application needs one common parameter in every action method.
In our case it is the customer account id and we need to support the following scenarios
a. A group of users might have the same account id which can be derived from the user profile.
b. Customer Support team should be able explicitly supply the account id of a customer and also should be able to switch the account on any page
We are trying to not to use asp.net session to store this kind of data.
Are there any other options to store and manage this kind of common parameter data?
Write it out as an ecrypted value to hidden field on your master page and supply the value to every view. When the user is in a a customer role, place a change account "control" on the page that is able to retrieve and update the account data -- via AJAX, perhaps -- to change the current account id. It might be easiest to do this with a custom base controller which gets the data via the ValueProvider directly and stores it as a property on the page rather than having it be a parameter to every method.
Use Routing for the value. So if you need to change the id you can use another URL or post it as a parameter.
Whenever you need the value just ask the ValueProvider for it.
In case it is blank - use the one from user profile.
Of course you'd better write small method that will do just that:
// Register route like:
route.MapRoute("ProvidesAccountId", "{controller}/{id}/account{accountId}/{action}.aspx")
// Property on the base controller
protected Account CurrentAccount {
get {
var accountId = ValueProvider.GetValue<int?>("accountId"); // GetValue is just a helper
if (accountId.HasValue)
return YourRepositor.GetAccountBy(accountId.Value);
return CurrentUser.Account;
}
}
Not to use current user's account hit the URL: Profile/123/account/Edit.aspx
To use another account you can hit the URL: Profile/123/account-456/Edit.aspx
You get the idea.
Cheers,
Dmitriy.