can we change snapshots name using toHavesnapshot() function - javascript

i want save snapshot with custom name but snapshot given default name suppose i want save the image name xyz.png but toHaveSnapShot()function save the name xyz-win32.png.
but I don't want save xyz-win32.png i want only save xyz.png please help me how to change name and then compare successfully visual comparison.
i want save snapshot with custom name but snapshot given default name suppose i want save the image name xyz.png but toHaveSnapShot()function save the name xyz-win32.png.
but I don't want save xyz-win32.png i want only save xyz.png please help me how to change name and then compare successfully visual comparison.

Related

Add Custom Filter to a field using linked entities using Javascript in Dynamics 365

I have a field where I want to add a custom filter. This filter will be based on the value of a linked entity.
But, I found out that we cannot have complex queries using addCustomFilter() method.
What is the other way to do the same?
Yes you can have complex queries. Build the query using FetchXml. Ok here the JS I've used. I'll explain. I have a user lookup which I filter using a custom view based on the value selected in another lookup called areas.
Create the javascript function below in the form that you want this functionality.
fetchXml is where you create the query. As you can see, I'm querying the system user entity, then crossing over to the AreaUserLink entity (join on tes_user = systemuserid) and then filtering on the tes_area field = the value inserted from the form field.
layoutXml is where you define the layout of the screen that gets displayed when the person clicks on the lookup and goes to the lookup details screen. You will need to amend those to fit your new scenario.
viewId is just a random GUID that you need to provide so that CRM can store it. It will need to be unique.
In the code below...
function AttachReviewByCustomView() {
    var areaLookup = Xrm.Page.getAttribute('tes_area').getValue();
    if (areaLookup == null) {
        return;
    }
    var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" +
        "<entity name='systemuser'><attribute name='fullname' /><attribute name='systemuserid' />" +
        "<order attribute='fullname' descending='false' />" +
        "<filter type='and'>" +
        "<condition attribute='isdisabled' value='0' operator='eq'/></filter>" +
        "<link-entity name='tes_userarealink' from='tes_user' to='systemuserid' alias='ak'>" +
        "<filter type='and'>" +
        "<condition attribute='tes_area' operator='eq' uitype='tes_area' value='" + areaLookup[0].id + "' />" +
        "</filter></link-entity></entity></fetch>";
    var layoutXml = "<grid name='resultset' object='1' jump='systemuserid' select='1' icon='1' preview='1'>" +
                    "<row name='result' id='systemuserid'>" +
                    "<cell name='fullname' width='150' />" +
                    "</row></grid>";
    var viewId = "{00000000-0000-0000-0000-000000000003}";
    var viewDisplayName = "Active Users In Selected User-Area";
    Xrm.Page.getControl("tes_operative").addCustomView(viewId, "systemuser", viewDisplayName, fetchXml, layoutXml, true);
}
Lastly you need to call this from two places.
1. When the form loads.
2. When the person selects a value from the dropdown field that is used in the fetchXml variable to filter.
Hope this helps.

How to lowercase field name in pdi (pentaho)?

I'm actually new to PDI and i need to do some extract from csv however sometimes field name are in lowercase or uppercase.
I know how to modify it for rows but don't know how to do it for fields names.
Does exist a step to do it?
I tried ${fieldName}.lower(), lower(${fieldName}) in select value and javascript script but without succes
thanks in advance
The quick fix is to right-click the list of column provided by the CSV file input to copy/paste it back and forth into Excel (or whatever).
If you also have 150 input files, the step which changes dynamically the column names (and other metadata like type) is called Metadata Injection, Kettle doc. The Official doc gives details and examples.
Your specific case is covered in BizCubed. Download the sample near the end of the web page, unzip, load the ktr in PDI. You'll need to adapt the Fields step in the MetaDataInjection transformation. It is currently a DataGrid that you may change by a Javascript lowercase (or better a String operation), after having kept the first line only of your CSV (read with header NOT present, include the rownumber and Filter rownumber=1).
If you want to change a column name you can use the 'Select values' step.
There is a 'Rename to' option in the 'Select & Alter' tab as well as the 'Meta-data' tab that you can use to change a column name to whatever you want.

How to delete an attribute when sending a partial object update to Algolia?

I need to use partialUpdateObject from the Algolia Javascript SDK to delete an attribute from an object that is already in the index.
My scenario is that I have a description field on my object that is optional. If the user originally sets a description and then later deletes it, I want to remove the description altogether from the object.
I do not want to overwrite the whole object (without the description attribute) because I have some count attributes on the object that I do not want to have to recalculate.
As far as I can tell in the documentation there isn't a way to do it and my workaround is to set the description as an empty string. Is that the recommended approach?
You're right: you cannot totally remove the attribute from an object with a partialUpdateObject operation. As a work-around you can set it to null, maybe that's enough for your use-case?
If you really want to delete the field you can :
Get your object with the search function
Store all fields values
Update (not partial update) your object without passing the field you want to delete

Dynamically set value in category.ftl

I have a form in share with multiple fields using category.ftl. I want to set default values in those fields dynamically. I can set default value by passing static path of category in share-config-custom.xml. But now my requirement is to read values stored in one file and than set those values as default in category.ftl.
For ex, On above screenshot I have set default language as English by passing English reference statically in share-config. So every time when a form renders it sets English as default language. I want this to be changed to set default language to value which is stored in file. So how to pass dynamic reference of category in share-config-custom.xml file?
Any help would be greatly appreciated!!!
You cant configure dynamic things in share-config-custom.xml.For that you need to workj on below things.
For each and every picker in alfresco ,alfresco share is using below javascript file.(This are YUI scripts)
1.generic-object-finder.js
2.object-finder.js
object-finder.js = >
This file is generally used when type of content is authority(users of alfresco).So i think this will be not used in your case.
generic-object-finder.js = >
This file is used for generic picker and using this you can set default values.
======================================================================
Below are steps to set value in picker.
1.Alfresco.util.ComponentManager.list("Alfresco.GenericObjectFinder")
Above method will return all object of picker , We need to pick one by one and set default value one by one in alfresco advanced search.It will return object in array form
2. X.options.defaultValue need to be set.
Where X will first element of Alfresco.util.ComponentManager.list("Alfresco.GenericObjectFinder") array
3.x.selectItems("workspace://SpacesStore/f73a4de7-7a45-412d-ac7d-56061fcf9d76")
Above will set default value.You must need to pass relevant value here.

how to autofill and enable submit and retrieve results from an external website

For example there is external website to check the name of person from registration number.Now I want to write a code where I start with specific number and increment it and each time fetch the record and store details in excel.My main issue is I dont wanna manually sit and type all the numbers in external website.I start with a number and automatically a code should increment number each time and fetch records.
OKay, use a static variable/session variable(Preferably static one); And set a default value to that variable; Then increment the value whenever the user passes the registration phase..
Eg:
Static string regNum="RN1000";
/* Make required operations , if valid then proceed */
regNum="RN"+(Convert.ToInt64(regNum.TrimStart('R').TrimStart('N'))+1).ToString();
This sort of condition could help you out.. :)

Categories

Resources